diff --git a/src/defs.h b/src/defs.h index d06d680..d9b0646 100644 --- a/src/defs.h +++ b/src/defs.h @@ -142,6 +142,7 @@ enum #define EF_NO_TELEPORT (2 << 17) #define EF_NO_OBSERVE (2 << 18) #define EF_BULLET_HIT (2 << 19) +#define EF_CRUSHABLE (2 << 20) #define GRAVITY_POWER 0.5f #define FRICTION 0.75f diff --git a/src/entities/decoration/debris.c b/src/entities/decoration/debris.c index f8ce334..354de05 100644 --- a/src/entities/decoration/debris.c +++ b/src/entities/decoration/debris.c @@ -34,7 +34,7 @@ void initDebris(Decoration *d) d->spriteFrame = 0; - d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT; + d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT | EF_CRUSHABLE; d->tick = tick; d->action = action; diff --git a/src/entities/decoration/fleshChunk.c b/src/entities/decoration/fleshChunk.c index fe601c9..99c1a23 100644 --- a/src/entities/decoration/fleshChunk.c +++ b/src/entities/decoration/fleshChunk.c @@ -30,7 +30,7 @@ void initFleshChunk(Decoration *d) d->type = ET_DECORATION; - d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT; + d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_NO_TELEPORT | EF_CRUSHABLE; d->bleedTime = FPS * 3; diff --git a/src/entities/items/consumable.c b/src/entities/items/consumable.c index 3a76f90..7f849ed 100644 --- a/src/entities/items/consumable.c +++ b/src/entities/items/consumable.c @@ -34,7 +34,7 @@ Item *initConsumable(void) i->type = ET_CONSUMABLE; - i->flags |= EF_IGNORE_BULLETS; + i->flags |= EF_IGNORE_BULLETS | EF_CRUSHABLE; i->health = FPS * 10; diff --git a/src/world/entities.c b/src/world/entities.c index 5335150..83941d7 100644 --- a/src/world/entities.c +++ b/src/world/entities.c @@ -257,6 +257,11 @@ void doEntities(void) if (!pushEntity(e, 0, e->riding->dy)) { e->riding->y -= e->riding->dy; + + if (e->flags & EF_CRUSHABLE) + { + e->health--; + } } e->y = e->riding->y - e->h;