This commit is contained in:
@@ -5,28 +5,12 @@
|
||||
#include "player.h"
|
||||
|
||||
void checkCollision(){
|
||||
float objdet[MAX_ENTITIES][3];
|
||||
|
||||
//array structure:
|
||||
// [entitiy #1][x,y,size]
|
||||
// [entitiy #2][x,y,size]
|
||||
// etc...
|
||||
|
||||
for (int i = 0; i < MAX_ENTITIES; i++){
|
||||
Entity *e = &entities[i];
|
||||
if (!e->active){
|
||||
continue;
|
||||
}
|
||||
objdet[i][0]=e->position.x;
|
||||
objdet[i][1]=e->position.y;
|
||||
objdet[i][2]=e->size;
|
||||
}
|
||||
for(int u=0; u<=MAX_ENTITIES; u++){
|
||||
Entity *en1 = &entities[u];
|
||||
for(int j=0; u<=MAX_ENTITIES; u++){
|
||||
Entity *en2 = &entities[j];
|
||||
if(u!=j){
|
||||
if(objdet[u][0]<objdet[j][0]){
|
||||
Entity *en2 = &entities[j];
|
||||
if(en1->position.x<en2.position.y){
|
||||
ApplyForce(
|
||||
en1,
|
||||
(Vector2){10000, 0}
|
||||
@@ -38,7 +22,5 @@ void checkCollision(){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user