aboutsummaryrefslogtreecommitdiff
path: root/src/entities/antifaShip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities/antifaShip.c')
-rw-r--r--src/entities/antifaShip.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/entities/antifaShip.c b/src/entities/antifaShip.c
index c2e292a..2d58510 100644
--- a/src/entities/antifaShip.c
+++ b/src/entities/antifaShip.c
@@ -1,8 +1,7 @@
#include "antifaShip.h"
#include "game.h"
#include "settings.h"
-
-// TODO: Get rid of some magic numbers.
+#include "bullets.h"
void initAntifaShip(Entity * entity, Game * game) {
entity->model = &game->assets.models[ANTIFA_SHIP_ASSET];
@@ -43,6 +42,23 @@ void controlAntifaShipJoystick(Game * game, Entity * entity) {
float rollStick = GetGamepadAxisMovement(gamePadNum, settings.rollStick);
float speedStick = GetGamepadAxisMovement(gamePadNum, settings.speedStick);
+ // 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);
+ }
+
Vector3 stick = (Vector3){
pitchStick,
-yawStick,