fix anims and icons
This commit is contained in:
parent
d59f7f8870
commit
bcf6958049
|
@ -84,4 +84,4 @@ target_link_libraries(addin LibProf::LibProf Gint::Gint)
|
|||
target_link_options(addin PRIVATE -Wl,-Map=map)
|
||||
|
||||
generate_g3a(TARGET addin OUTPUT "RogueLif.g3a"
|
||||
NAME "RogueLife" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
||||
NAME "Rogue Life" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
|
@ -122,6 +122,11 @@ entity_movement_t entity_move4(entity_t *e, int direction, fixed_t dt)
|
|||
return entity_move(e, fdir(direction), dt);
|
||||
}
|
||||
|
||||
bool entity_moving(entity_t const *e)
|
||||
{
|
||||
return (e->movement.vx != 0) || (e->movement.vy != 0);
|
||||
}
|
||||
|
||||
void entity_set_normal_anim(entity_t *e, anim_frame_t *frame)
|
||||
{
|
||||
e->anim.frame = frame;
|
||||
|
|
|
@ -95,6 +95,9 @@ entity_movement_t entity_move4(entity_t *e, int direction, fixed_t dt);
|
|||
/* Update walk/sprint movement in any direction (for IAs) */
|
||||
entity_movement_t entity_move(entity_t *e, fpoint_t direction, fixed_t dt);
|
||||
|
||||
/* Check if the entity is currently moving */
|
||||
bool entity_moving(entity_t const *e);
|
||||
|
||||
/* Start dashing in the set direction */
|
||||
void entity_dash(entity_t *e, int direction);
|
||||
|
||||
|
|
|
@ -357,9 +357,14 @@ int main(void)
|
|||
}
|
||||
entity_movement_t next = entity_move4(player, dir, dt);
|
||||
|
||||
bool set_anim = (player->movement.facing != next.facing);
|
||||
bool set_anim = (player->movement.facing != next.facing) ||
|
||||
((entity_moving(player) == 0) != (dir == -1));
|
||||
|
||||
game_try_move_entity(&game, player, &next);
|
||||
if(set_anim) entity_set_anim(player, anims_player_Walking);
|
||||
if(set_anim && dir >= 0)
|
||||
entity_set_anim(player, anims_player_Walking);
|
||||
else if(set_anim && dir < 0)
|
||||
entity_set_anim(player, anims_player_Idle);
|
||||
}
|
||||
|
||||
/* Directions to reach the player from anywhere on the grid */
|
||||
|
|
Loading…
Reference in New Issue