X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/6a7303f223740a77dfea26da72ce2557691d4546..eb0884ecd703881e43b1c34ac04e0d49dbab4c38:/badge/jumpnrun/enemies.c diff --git a/badge/jumpnrun/enemies.c b/badge/jumpnrun/enemies.c index 09a8764..cc72db3 100644 --- a/badge/jumpnrun/enemies.c +++ b/badge/jumpnrun/enemies.c @@ -139,11 +139,15 @@ void enemy_collision_tiles_bounce_horiz(jumpnrun_enemy *self, jumpnrun_tile_range const *visible_tiles) { vec2d inertia_mod = self->base.inertia; - collisions_tiles_displace(desired_position, - &self->base, - lv, - visible_tiles, - &inertia_mod); + bool killed = collisions_tiles_displace(desired_position, + &self->base, + lv, + visible_tiles, + &inertia_mod); + + if(killed) { + self->flags &= ~JUMPNRUN_ENEMY_SPAWNED; + } if(fixed_point_ne(inertia_mod.x, self->base.inertia.x)) { self->base.inertia.x = fixed_point_neg(self->base.inertia.x);