From 78422382e2b73ac3975c20a11961c550e3aaea5c Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 4 Feb 2018 11:00:32 +0000 Subject: [PATCH] Added default die() function. --- src/entities/entity.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/entities/entity.c b/src/entities/entity.c index fd9cf0a..4879ced 100644 --- a/src/entities/entity.c +++ b/src/entities/entity.c @@ -26,6 +26,7 @@ static void action(void); static void applyDamage(int damage); static float bounce(float x); static void tick(void); +static void die(void); static void activate(int active); static void touch(Entity *other); static void animate(void); @@ -66,6 +67,7 @@ void initEntity(Entity *e) e->applyDamage = applyDamage; e->bounce = bounce; e->getCurrentSprite = getCurrentSprite; + e->die = die; e->load = load; e->save = save; @@ -132,7 +134,6 @@ static float bounce(float x) static void applyDamage(int damage) { - } static void tick(void) @@ -147,6 +148,11 @@ static void activate(int active) { } +static void die(void) +{ + self->alive = ALIVE_DEAD; +} + static SDL_Rect *getCurrentSprite(void) { return &self->sprite[self->facing]->frames[self->spriteFrame]->rect;