Commit 8c2a6ab1 authored by Benjamin LEROUX's avatar Benjamin LEROUX

ajout highscore different par niveau

parent 0e5877be
......@@ -63,7 +63,7 @@ static Food goldenFruit = {0};
static Food deadFruit = {0};
static Rectangle recTab[NUMBEROFWALL];
static int highscore;
static int highscore=0;
static Sound fruitSound ;
static Sound goldenFruitSound;
static Sound deathSound;
......@@ -218,7 +218,9 @@ void InitGame(void)
recTab[7].height=(SQUARE_SIZE)-0.1;
}
highscore=LoadStorageValue(0);
if(level==2){
highscore=LoadStorageValue(1);
}else highscore=LoadStorageValue(0);
//sons
fruitSound = LoadSound("SnakeSounds\\shroom.mp3"); // Load audio files
......@@ -481,9 +483,13 @@ void DrawGame(void)
DrawText(TextFormat("TIME: %.02f", (float)framesCounter/60), screenWidth/2 - MeasureText("TIME: 00.00", 60)/2, screenHeight/2 - 120, 60, BLUE);
DrawText(TextFormat("SCORE: %04i",snake[0].score ), screenWidth/2 - MeasureText("SCORE: 0000", 60)/2, screenHeight/2 - 180, 60, BLUE);
if(highscore<snake[0].score){
if(level==2){
SaveStorageValue(1,snake[0].score);
highscore=LoadStorageValue(1);
}else{
SaveStorageValue(0,snake[0].score);
highscore=LoadStorageValue(0);
}
}
DrawText(TextFormat("HIGHSCORE: %04i",highscore ), screenWidth/2 - MeasureText("HIGHSCORE: 0000", 60)/2, screenHeight - 100, 60, RED);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment