Set item health to 0 when picked up, action to NULL.

This commit is contained in:
Steve 2015-11-18 11:27:46 +00:00
parent a776005a65
commit c5c98e9317
1 changed files with 3 additions and 1 deletions

View File

@ -106,7 +106,7 @@ static void action(void)
{ {
if ((e->flags & EF_COLLECTS_ITEMS) && collision(self->x - (self->w / 2), self->y - (self->h / 2), self->w, self->h, e->x - (e->w / 2), e->y - (e->h / 2), e->w, e->h)) if ((e->flags & EF_COLLECTS_ITEMS) && collision(self->x - (self->w / 2), self->y - (self->h / 2), self->w, self->h, e->x - (e->w / 2), e->y - (e->h / 2), e->w, e->h))
{ {
self->alive = ALIVE_DEAD; self->health = 0;
playBattleSound(SND_GET_ITEM, self->x, self->y); playBattleSound(SND_GET_ITEM, self->x, self->y);
updateObjective(self->name, TT_ITEM); updateObjective(self->name, TT_ITEM);
@ -118,6 +118,8 @@ static void action(void)
addHudMessage(colors.white, "Picked up %s", self->name); addHudMessage(colors.white, "Picked up %s", self->name);
battle.stats[STAT_ITEMS_COLLECTED]++; battle.stats[STAT_ITEMS_COLLECTED]++;
} }
self->action = NULL;
} }
} }
} }