aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--enemy.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/enemy.c b/enemy.c
index 1e5a4d2..5901445 100644
--- a/enemy.c
+++ b/enemy.c
@@ -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);
}
}
}