summary refs log tree commit diff
diff options
context:
space:
mode:
authorzlago2025-01-26 19:04:22 +0100
committerzlago2025-01-26 19:04:22 +0100
commit1e792e1a30aeb9f19518b56936cc9154164c3f76 (patch)
treea90dfc7175781de7ab6789df664f7af0010f8262
parentcc0650b5d0fd31128263a3ad2437a7e13e92e5da (diff)
player animation tweaks
-rw-r--r--src/player.c13
1 files changed, 13 insertions, 0 deletions
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;