This commit is contained in:
@@ -5,21 +5,23 @@
|
||||
#include "player.h"
|
||||
|
||||
void checkCollision(){
|
||||
for(int u=0; u<=MAX_ENTITIES; u++){
|
||||
for(int u=0; u<=MAX_ENTITIES-1; u++){
|
||||
Entity *en1 = &entities[u];
|
||||
for(int j=0; j<=MAX_ENTITIES; j++){
|
||||
for(int j=1; j<=MAX_ENTITIES-1; j++){
|
||||
if(u!=j){
|
||||
Entity *en2 = &entities[j];
|
||||
//if(en1->position.x>en2->position.x){
|
||||
if (fabsf(en1->position.x - en2->position.x) < (en1->size * 0.5f + en2->size * 0.5f))
|
||||
{
|
||||
ApplyForce(
|
||||
en1,
|
||||
(Vector2){100000, 0}
|
||||
(Vector2){10000, 0}
|
||||
);
|
||||
ApplyForce(
|
||||
en2,
|
||||
(Vector2){-100000, 0}
|
||||
(Vector2){-10000, 0}
|
||||
);
|
||||
//}
|
||||
}
|
||||
if(fabsf(en1->position.y - en2->position.y) < (en1->size * 0.5f + en2->size * 0.5f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user