This commit is contained in:
@@ -12,25 +12,37 @@ void checkCollision(){
|
|||||||
Entity *en2 = &entities[j];
|
Entity *en2 = &entities[j];
|
||||||
if (fabsf(en1->position.x - en2->position.x) < (en1->size * 0.5f + en2->size * 0.5f))
|
if (fabsf(en1->position.x - en2->position.x) < (en1->size * 0.5f + en2->size * 0.5f))
|
||||||
{
|
{
|
||||||
ApplyForce(
|
if(en1->position.x < en2->position.x){
|
||||||
en1,
|
ApplyForce(
|
||||||
(Vector2){10000, 0}
|
en1,
|
||||||
);
|
(Vector2){-10000, 0}
|
||||||
ApplyForce(
|
);
|
||||||
en2,
|
ApplyForce(
|
||||||
(Vector2){-10000, 0}
|
en2,
|
||||||
);
|
(Vector2){10000, 0}
|
||||||
}
|
);
|
||||||
if(fabsf(en1->position.y - en2->position.y) < (en1->size * 0.5f + en2->size * 0.5f)){
|
}
|
||||||
ApplyForce(
|
else{
|
||||||
en1,
|
ApplyForce(
|
||||||
(Vector2){0, 10000}
|
en1,
|
||||||
);
|
(Vector2){10000, 0}
|
||||||
ApplyForce(
|
);
|
||||||
en2,
|
ApplyForce(
|
||||||
(Vector2){0, -10000}
|
en2,
|
||||||
);
|
(Vector2){-10000, 0}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// if(fabsf(en1->position.y - en2->position.y) < (en1->size * 0.5f + en2->size * 0.5f)){
|
||||||
|
// ApplyForce(
|
||||||
|
// en1,
|
||||||
|
// (Vector2){0, 10000}
|
||||||
|
// );
|
||||||
|
// ApplyForce(
|
||||||
|
// en2,
|
||||||
|
// (Vector2){0, -10000}
|
||||||
|
// );
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
wrldboxMacOS
BIN
wrldboxMacOS
Binary file not shown.
Reference in New Issue
Block a user