diff options
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){ |