horizontal collision works
Some checks failed
Build Project / build (push) Failing after 10m39s

This commit is contained in:
swim67667
2026-06-24 11:46:32 -04:00
parent c29f652cdc
commit c079ca620f
2 changed files with 30 additions and 18 deletions

View File

@@ -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}
// );
// }
} }
} }
} }

Binary file not shown.