Skip to content
Snippets Groups Projects
Commit aad3af52 authored by belkhiritaha's avatar belkhiritaha
Browse files

update affichage du waterlevel

parent 8c7b6dcf
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ void initPlayer(){
player.y = 0;
player.w = CELLSIZE*0.8;
player.h = CELLSIZE*0.8;
player.waterLevel = 0;
player.waterLevel = 3;
player.speed = 1;
player.isMoving = 0;
}
......
......@@ -179,12 +179,12 @@ void drawFire(){
void drawPlayerWaterLevel(){
int borderWidth = (screenDimension.w - (MAPSIZE * CELLSIZE)) / 2;
SDL_Rect rect;
rect.h = borderWidth/4;
rect.w = borderWidth/4;
rect.h = borderWidth/3;
rect.w = borderWidth/3;
int count = player.waterLevel;
for (int i=0; i<3; i++){
rect.x = (i*rect.h);
rect.y = screenDimension.h/4;
rect.y = screenDimension.h/3;
if (count){
count--;
SDL_RenderCopy(renderer, filledBucketTexture, NULL, &rect);
......@@ -201,6 +201,7 @@ void drawGame(){
drawMap();
drawPlayer();
drawFire();
drawPlayerWaterLevel();
SDL_RenderPresent(renderer);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment