aboutsummaryrefslogtreecommitdiff
path: root/src/entities/missile.c
diff options
context:
space:
mode:
authornathansmithsmith <nathansmith7@mailfence.com>2023-09-16 20:48:47 -0600
committernathansmithsmith <nathansmith7@mailfence.com>2023-09-16 20:48:47 -0600
commit2c3290f9edebbde37737cc446a0e9f93e9430c06 (patch)
tree807fa59074bd38ab5e8c23257aa2b03234f6bc7e /src/entities/missile.c
parent7ffeaacac296155632705f2a494683d3bdffa684 (diff)
The missile does damage now
Diffstat (limited to 'src/entities/missile.c')
-rw-r--r--src/entities/missile.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/entities/missile.c b/src/entities/missile.c
index 575fbdc..c8c8e92 100644
--- a/src/entities/missile.c
+++ b/src/entities/missile.c
@@ -103,6 +103,15 @@ void startMissileCountDown(Entity * entity, double timeToLive) {
// Fucking boom boom time!!!!
void missileGoBoomBoom(Game * game, Entity * entity) {
+ Missile * data = (Missile*)entity->data;
+ Entity * player = getEntityFromWorld(game->world, 0);
+
+ // Do some damage to the player.
+ float distance = Vector3Distance(player->position, entity->position);
+ float damage = data->damage / distance;
+ player->health -= damage;
+
entity->health = 0.0;
- puts("boom boom like the boomers");
+
+ printf("This old fuck did %f damage at %f distance\n", damage, distance);
}