diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | intermediate/guy_slash_left.anm | 5 | ||||
-rw-r--r-- | intermediate/guy_slash_right.anm | 5 | ||||
-rw-r--r-- | obj.h | 2 | ||||
-rw-r--r-- | player.c | 11 |
5 files changed, 22 insertions, 3 deletions
@@ -72,6 +72,8 @@ anim_sources = \ $(int_dir)/guy_jump_right.anm \ $(int_dir)/guy_run_left.anm \ $(int_dir)/guy_run_right.anm \ + $(int_dir)/guy_slash_left.anm \ + $(int_dir)/guy_slash_right.anm \ $(int_dir)/slash_right.anm \ $(int_dir)/slash_left.anm \ diff --git a/intermediate/guy_slash_left.anm b/intermediate/guy_slash_left.anm new file mode 100644 index 0000000..e6581af --- /dev/null +++ b/intermediate/guy_slash_left.anm @@ -0,0 +1,5 @@ +1 +{ 64, 16, 16, 16 } +{ 80, 16, 16, 16 } +{ 80, 16, 16, 16 } +{ 80, 16, 16, 16 } diff --git a/intermediate/guy_slash_right.anm b/intermediate/guy_slash_right.anm new file mode 100644 index 0000000..e7ada8d --- /dev/null +++ b/intermediate/guy_slash_right.anm @@ -0,0 +1,5 @@ +1 +{ 64, 0, 16, 16 } +{ 80, 0, 16, 16 } +{ 80, 0, 16, 16 } +{ 80, 0, 16, 16 } @@ -18,7 +18,7 @@ typedef struct { int frame; int anim; int grounded, headbutted, on_ramp, jumping; - int cooldown; + int cooldown, slashing; Face face; Rect rect; } Player; @@ -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: |