From 1e792e1a30aeb9f19518b56936cc9154164c3f76 Mon Sep 17 00:00:00 2001 From: zlago Date: Sun, 26 Jan 2025 19:04:22 +0100 Subject: player animation tweaks --- src/player.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/player.c b/src/player.c index 126b2ea..40c5f6f 100644 --- a/src/player.c +++ b/src/player.c @@ -38,6 +38,11 @@ enum { PLAYER_A_JUMP, PLAYER_A_FALL, PLAYER_A_FALL2, + PLAYER_A_HOP, + PLAYER_A_HOP2, + PLAYER_A_HOP3, + PLAYER_A_CROUCH, + PLAYER_A_CROUCH2, }; struct anim player_anims[] = { @@ -50,6 +55,11 @@ struct anim player_anims[] = { {PLAYER_A_JUMP, {16, 0, 16, 16}, 300}, {PLAYER_A_FALL2, {32, 0, 16, 16}, 15}, {PLAYER_A_FALL2, {48, 0, 16, 16}, 15}, + {PLAYER_A_HOP2, {16, 0, 16, 16}, 4}, + {PLAYER_A_HOP3, {32, 0, 16, 16}, 4}, + {PLAYER_A_CROUCH, {48, 0, 16, 16}, 4}, + {PLAYER_A_CROUCH2, {64, 0, 16, 16}, 300}, + {PLAYER_A_CROUCH, {80, 0, 16, 16}, 2}, }; enum slash_type { @@ -291,6 +301,7 @@ static int player_update(struct entity *self) { } attack(self, 0, SLASH_NORMAL); if (input_s(input_pressed)) { + anim(self, PLAYER_A_CROUCH); self->state = PLAYER_ATTACK2; self->timer = 30; } @@ -316,6 +327,7 @@ static int player_update(struct entity *self) { } attack(self, 1, SLASH_STRONG); if (input_s(input_pressed)) { + anim(self, PLAYER_A_HOP); self->state = PLAYER_ATTACK3; self->timer = 60; } @@ -340,6 +352,7 @@ static int player_update(struct entity *self) { self->state = PLAYER_JUMP; } if (self->timer-- == 0) { + anim(self, PLAYER_A_IDLE); self->state = PLAYER_IDLE; } break; -- cgit 1.4.1-2-gfad0