diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-20 03:08:57 -0600 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-20 03:08:57 -0600 |
commit | 43e31b6e124da754ef928d22fbb9a1d7640aab4b (patch) | |
tree | 698f723866bd99982a6c606c63cfa0387863e2db /src/entities/antifaShip.c | |
parent | f3f5fedbf591c10fa675a32103bab9480b42abe8 (diff) |
New bullet system
Diffstat (limited to 'src/entities/antifaShip.c')
-rw-r--r-- | src/entities/antifaShip.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/entities/antifaShip.c b/src/entities/antifaShip.c index 2d58510..1b90ea7 100644 --- a/src/entities/antifaShip.c +++ b/src/entities/antifaShip.c @@ -44,19 +44,15 @@ void controlAntifaShipJoystick(Game * game, Entity * entity) { // Shoot button. if (IsGamepadButtonPressed(gamePadNum, 8)) { - Vector3 dir = Vector3Normalize(Vector3Subtract( - getEntityFromWorld(game->world, 1)->position, - entity->position - )); - - Bullet bullet = createBullet( - *entity, - dir, - Vector3Zero(), - 0.1 - ); - - addBullet(&game->bullets, bullet); + Bullet bullet = createBulletFromEntity(*entity, 1.0); + BulletHitInfo info = shootBullet(&game->world, bullet); + + if (info.hit) { + Entity * hitEntity = getEntityFromWorld(game->world, info.hitId); + printVector3(hitEntity->position); + } else { + puts("no stink"); + } } Vector3 stick = (Vector3){ |