diff options
-rw-r--r-- | enemy.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -82,7 +82,7 @@ void update_enemy_phys(Enemy* e, const Map* map) { void update_enemy_hurt(Enemy* e, World* w) { Rect a; - int i; + int i, cx, cy; if (e->inv) { e->inv--; return; @@ -90,6 +90,8 @@ void update_enemy_hurt(Enemy* e, World* w) { get_enemy_rect(e->t, &a); a.x += e->x >> fbits; a.y += e->y >> fbits; + cx = (a.x << fbits) + ((a.w >> 1) << fbits); + cy = (a.y << fbits) + ((a.h >> 1) << fbits); for (i = 0; i < w->deathzone_count; i++) { const Deathzone* dz = &w->deathzones[i]; if (dz->friendly && rects_overlap(&a, &dz->r)) { @@ -99,6 +101,7 @@ void update_enemy_hurt(Enemy* e, World* w) { e->inv = enemy_inv_frames; w->player.charge++; w->freeze += enemy_hurt_freeze; + inst_effect(w, cx, cy, -dz->vx, -dz->vy, 32); } } } |