fixed bad array definition
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include "player.h"
|
||||
|
||||
void checkCollision(){
|
||||
objdet[MAX_ENTITIES][4];
|
||||
float objdet[MAX_ENTITIES][3];
|
||||
|
||||
//array structure:
|
||||
// [entitiy #1][entity obj,x,y,size]
|
||||
@@ -17,21 +17,22 @@ void checkCollision(){
|
||||
if (!e->active){
|
||||
continue;
|
||||
}
|
||||
objdet[i][0]=e;
|
||||
objdet[i][1]=e->position.x;
|
||||
objdet[i][2]=e->position.y;
|
||||
objdet[i][3]=e->size;
|
||||
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][1]<objdet[j][1]){
|
||||
if(objdet[u][0]<objdet[j][0]){
|
||||
ApplyForce(
|
||||
objdet[u][0],
|
||||
en1,
|
||||
(Vector2){10000, 0}
|
||||
);
|
||||
ApplyForce(
|
||||
objdet[j][0],
|
||||
en2,
|
||||
(Vector2){-10000, 0}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user