player animation

This commit is contained in:
cyjullien1
2025-01-07 23:22:13 +01:00
parent f566362d1c
commit 2d6a251f3c
9 changed files with 50 additions and 16 deletions

View File

@@ -43,9 +43,10 @@ void screenDisplay (char **tab, int x ,int y )
* l'affichage SDL
* \param player_pos la position du joueur
* \param fov Le fov de la vision du joueur, -1 si desactiver.
* \param direction La direction du personnage.
* \return Void
*/
void screenDisplayGameSDL (char **tab,vect dim_tab, dis *display_user, vect *player_pos, int fov)
void screenDisplayGameSDL (char **tab,vect dim_tab, dis *display_user, vect *player_pos, int fov, vect direction)
{
unsigned int display_game
= display_user->size_window - display_user->size_menu;
@@ -102,7 +103,11 @@ void screenDisplayGameSDL (char **tab,vect dim_tab, dis *display_user, vect *pla
break;
case PLAYER:
img = IMG_Load ("image/player.png");
if(direction.y == 1){ img = IMG_Load ("image/player.png");}
else if(direction.y == -1){ img = IMG_Load ("image/playerLeft.png");}
else if(direction.x == -1){ img = IMG_Load ("image/playerUp.png");}
else if(direction.x == 1){ img = IMG_Load ("image/playerDown.png");}
else if(direction.y == 0 && direction.x == 0){ img = IMG_Load ("image/playerFall.png");}
break;
case TARGET:
img = IMG_Load ("image/target.png");