aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--intermediate/guy_slash_left.anm5
-rw-r--r--intermediate/guy_slash_right.anm5
-rw-r--r--obj.h2
-rw-r--r--player.c11
5 files changed, 22 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 74ad6e3..7be7f78 100644
--- a/Makefile
+++ b/Makefile
@@ -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 }
diff --git a/obj.h b/obj.h
index 7f93ecc..57172f5 100644
--- a/obj.h
+++ b/obj.h
@@ -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;
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: