diff --git a/scenes/constants.h b/scenes/constants.h index 30ee695..8b8ad17 100644 --- a/scenes/constants.h +++ b/scenes/constants.h @@ -24,7 +24,7 @@ #define PLAYER_WIDTH 30 #define PLAYER_HEIGHT 42 #define PLAYER_C_WIDTH 30 -#define PLAYER_C_HEIGHT 30 +#define PLAYER_C_HEIGHT 26 #else #define PLAYER_WIDTH 14 #define PLAYER_HEIGHT 30 diff --git a/scenes/player_ent.c b/scenes/player_ent.c index 3980c99..0fa5c0d 100644 --- a/scenes/player_ent.c +++ b/scenes/player_ent.c @@ -4,7 +4,7 @@ #include #include "raymath.h" -#define N_PLAYER_SPRITES 7 +#define N_PLAYER_SPRITES 8 enum PlayerSpriteEnum { SPR_PLAYER_STAND = 0, @@ -13,6 +13,7 @@ enum PlayerSpriteEnum SPR_PLAYER_FALL, SPR_PLAYER_LADDER, SPR_PLAYER_CROUCH, + SPR_PLAYER_CRMOVE, SPR_PLAYER_SWIM, }; @@ -31,17 +32,13 @@ static unsigned int player_sprite_transition_func(Entity_t* ent) if (p_move->ground_state & 1) { - if (p_plr->is_crouch) + if (Vector2LengthSqr(p_ctrans->velocity) > 1000.0f) { - return SPR_PLAYER_CROUCH; + return (p_plr->is_crouch) ? SPR_PLAYER_CRMOVE : SPR_PLAYER_RUN; } else { - if (Vector2LengthSqr(p_ctrans->velocity) > 1000.0f) - { - return SPR_PLAYER_RUN; - } - return SPR_PLAYER_STAND; + return (p_plr->is_crouch) ? SPR_PLAYER_CROUCH : SPR_PLAYER_STAND; } } else if (p_plr->ladder_state)