From 5ae0a01f81f98b6bed04ec6e3c6a687317489d91 Mon Sep 17 00:00:00 2001 From: quou Date: Tue, 1 Oct 2024 20:40:11 +1000 Subject: special charge --- config.h | 1 + enemy.c | 3 ++- obj.h | 2 +- player.c | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index 33364a5..b45b64f 100644 --- a/config.h +++ b/config.h @@ -40,6 +40,7 @@ #define player_lunge_force (f1) #define player_slash_damage 1 #define player_health 8 +#define player_special_hits 4 #define enemy_inv_frames 8 #define enemy_demon_move_force 32 diff --git a/enemy.c b/enemy.c index 66e0e73..1e46cb1 100644 --- a/enemy.c +++ b/enemy.c @@ -80,7 +80,7 @@ void update_enemy_phys(Enemy* e, const Map* map) { ); } -void update_enemy_hurt(Enemy* e, const World* w) { +void update_enemy_hurt(Enemy* e, World* w) { Rect a; int i; if (e->inv) { @@ -97,6 +97,7 @@ void update_enemy_hurt(Enemy* e, const World* w) { e->vx -= dz->vx; e->vy -= dz->vy; e->inv = enemy_inv_frames; + w->player.charge++; } } } diff --git a/obj.h b/obj.h index 2b151b7..a74b015 100644 --- a/obj.h +++ b/obj.h @@ -19,7 +19,7 @@ typedef struct { int anim; int grounded, headbutted, on_ramp, jumping; int cooldown, slashing; - int inv, hp; + int inv, hp, charge; Face face; Rect rect; } Player; diff --git a/player.c b/player.c index 7326fca..e94f18c 100644 --- a/player.c +++ b/player.c @@ -26,6 +26,7 @@ void init_player(Player* p) { p->face = face_right; p->inv = 0; p->hp = player_health; + p->charge = 0; } void update_player_anim(Player* p) { -- cgit v1.2.3-54-g00ecf