From 800559b72d31126ea6ae787f2b470f7824eafaa3 Mon Sep 17 00:00:00 2001 From: quou Date: Mon, 30 Sep 2024 19:08:22 +1000 Subject: player slash animation --- player.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'player.c') diff --git a/player.c b/player.c index 77d0b01..67a4817 100644 --- a/player.c +++ b/player.c @@ -20,6 +20,7 @@ void init_player(Player* p) { p->on_ramp = 0; p->jumping = 0; p->cooldown = 0; + p->slashing = 0; p->face = face_right; } @@ -106,12 +107,17 @@ void update_player_move(Player* p, const App* a, World* w) { } inst_particle(w, sx, sy, anim, asset_id_arms_img); p->cooldown = 10; + p->slashing = get_animation(asset_id_guy_slash_left_anm)->fc; + } + if (p->slashing) { + p->slashing--; } jumping = p->jumping; nanim = p->anim; switch (p->face) { case face_left: - nanim = + nanim = p->slashing? + asset_id_guy_slash_left_anm: grounded ? moving ? asset_id_guy_run_left_anm: @@ -121,7 +127,8 @@ void update_player_move(Player* p, const App* a, World* w) { asset_id_guy_fall_left_anm; break; case face_right: - nanim = + nanim = p->slashing? + asset_id_guy_slash_right_anm: grounded ? moving ? asset_id_guy_run_right_anm: -- cgit v1.2.3-54-g00ecf