aboutsummaryrefslogtreecommitdiff
path: root/player.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-09-30 19:08:22 +1000
committerquou <quou@disroot.org>2024-09-30 19:08:22 +1000
commit800559b72d31126ea6ae787f2b470f7824eafaa3 (patch)
tree96d953c0540ccab99d028772ddee1abb3f266149 /player.c
parent7664fdafb9a6d6f4aa3339fe38958b24b234218e (diff)
player slash animation
Diffstat (limited to 'player.c')
-rw-r--r--player.c11
1 files changed, 9 insertions, 2 deletions
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: