Added default die() function.

This commit is contained in:
Steve 2018-02-04 11:00:32 +00:00
parent 1fbf7971b8
commit 78422382e2
1 changed files with 7 additions and 1 deletions

View File

@ -26,6 +26,7 @@ static void action(void);
static void applyDamage(int damage); static void applyDamage(int damage);
static float bounce(float x); static float bounce(float x);
static void tick(void); static void tick(void);
static void die(void);
static void activate(int active); static void activate(int active);
static void touch(Entity *other); static void touch(Entity *other);
static void animate(void); static void animate(void);
@ -66,6 +67,7 @@ void initEntity(Entity *e)
e->applyDamage = applyDamage; e->applyDamage = applyDamage;
e->bounce = bounce; e->bounce = bounce;
e->getCurrentSprite = getCurrentSprite; e->getCurrentSprite = getCurrentSprite;
e->die = die;
e->load = load; e->load = load;
e->save = save; e->save = save;
@ -132,7 +134,6 @@ static float bounce(float x)
static void applyDamage(int damage) static void applyDamage(int damage)
{ {
} }
static void tick(void) 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) static SDL_Rect *getCurrentSprite(void)
{ {
return &self->sprite[self->facing]->frames[self->spriteFrame]->rect; return &self->sprite[self->facing]->frames[self->spriteFrame]->rect;