aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h1
-rw-r--r--player.c2
-rw-r--r--world.c5
-rw-r--r--world.h2
4 files changed, 9 insertions, 1 deletions
diff --git a/config.h b/config.h
index b45b64f..e49126e 100644
--- a/config.h
+++ b/config.h
@@ -41,6 +41,7 @@
#define player_slash_damage 1
#define player_health 8
#define player_special_hits 4
+#define player_hurt_freeze 4
#define enemy_inv_frames 8
#define enemy_demon_move_force 32
diff --git a/player.c b/player.c
index e94f18c..4d23a05 100644
--- a/player.c
+++ b/player.c
@@ -171,6 +171,8 @@ void update_player_hurt(Player* p, World* w) {
p->vx -= dz->vx;
p->vy -= dz->vy;
p->inv = enemy_inv_frames;
+ w->freeze = player_hurt_freeze;
+ return;
}
}
}
diff --git a/world.c b/world.c
index 18cc6cd..fc137ee 100644
--- a/world.c
+++ b/world.c
@@ -6,6 +6,7 @@ void init_world(World* w) {
w->enemy_count = 0;
w->deathzone_count = 0;
w->frame = 0;
+ w->freeze = 0;
init_player(&w->player);
}
@@ -54,6 +55,10 @@ Deathzone* inst_deathzone(
void update_world(World* w, const App* a) {
int i;
+ if (w->freeze) {
+ w->freeze--;
+ return;
+ }
for (i = w->deathzone_count - 1; i >= 0; i--)
if (update_deathzone(&w->deathzones[i]))
w->deathzones[i] = w->deathzones[--w->deathzone_count];
diff --git a/world.h b/world.h
index f8f5768..d691a6a 100644
--- a/world.h
+++ b/world.h
@@ -18,7 +18,7 @@ typedef struct World {
int deathzone_count;
Player player;
Map map;
- int frame;
+ int frame, freeze;
} World;
void init_world(World* w);