This commit is contained in:
cyjullien1
2025-01-07 18:30:38 +01:00
parent 40c0ede871
commit 2c39110885
5 changed files with 110 additions and 46 deletions

View File

@@ -178,15 +178,16 @@ void move (char **tab, vect *playerPos, vect direction, score *score_user)
switch (returnValue)
{
case 0:
playAudio(2);
break;
case 1:
// move player
//move player
playAudio(4);
tab[playerPos->x + direction.x][playerPos->y + direction.y] = PLAYER;
break;
case 2:
// move player and the box
playAudio(5);
tab[playerPos->x + direction.x][playerPos->y + direction.y] = PLAYER;
tab[playerPos->x + direction.x * 2][playerPos->y + direction.y * 2]
= BOX;
@@ -194,7 +195,7 @@ void move (char **tab, vect *playerPos, vect direction, score *score_user)
break;
case 3:
// move player and the box is well-placed
playAudio(3);
tab[playerPos->x + direction.x][playerPos->y + direction.y] = PLAYER;
tab[playerPos->x + direction.x * 2][playerPos->y + direction.y * 2]
= BOX_ON_TARGET;
@@ -202,13 +203,13 @@ void move (char **tab, vect *playerPos, vect direction, score *score_user)
break;
case 4:
// move player on a target
playAudio(4);
tab[playerPos->x + direction.x][playerPos->y + direction.y]
= PLAYER_ON_TARGET;
break;
case 5:
// move box and player on a target
playAudio(4);
tab[playerPos->x + direction.x * 2][playerPos->y + direction.y * 2]
= BOX;
tab[playerPos->x + direction.x][playerPos->y + direction.y]
@@ -217,7 +218,7 @@ void move (char **tab, vect *playerPos, vect direction, score *score_user)
break;
case 6:
// move player on a target and box on a target
playAudio(3);
tab[playerPos->x + direction.x * 2][playerPos->y + direction.y * 2]
= BOX_ON_TARGET;
tab[playerPos->x + direction.x][playerPos->y + direction.y]
@@ -225,6 +226,7 @@ void move (char **tab, vect *playerPos, vect direction, score *score_user)
score_user->move_box++;
break;
case 7:
playAudio(3);
tab[playerPos->x + direction.x][playerPos->y + direction.y]
= PLAYER_ON_BUTTON;
break;
@@ -837,8 +839,8 @@ void winOrLoseLoop(dis *display_user,score *score_user, bool win)
SDL_Surface *img;
SDL_Texture *texture;
if(win) img = IMG_Load("image/win.png");
else img = IMG_Load("image/lose.png");
if(win){ img = IMG_Load("image/win.png");playAudio(0);}
else {img = IMG_Load("image/lose.png");playAudio(1);}
texture = SDL_CreateTextureFromSurface (display_user->renderer, img);