Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SnakeProject
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Benjamin LEROUX
SnakeProject
Commits
8c2a6ab1
Commit
8c2a6ab1
authored
Oct 30, 2020
by
Benjamin LEROUX
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout highscore different par niveau
parent
0e5877be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
snake.c
snake.c
+11
-5
No files found.
snake.c
View file @
8c2a6ab1
...
@@ -63,7 +63,7 @@ static Food goldenFruit = {0};
...
@@ -63,7 +63,7 @@ static Food goldenFruit = {0};
static
Food
deadFruit
=
{
0
};
static
Food
deadFruit
=
{
0
};
static
Rectangle
recTab
[
NUMBEROFWALL
];
static
Rectangle
recTab
[
NUMBEROFWALL
];
static
int
highscore
;
static
int
highscore
=
0
;
static
Sound
fruitSound
;
static
Sound
fruitSound
;
static
Sound
goldenFruitSound
;
static
Sound
goldenFruitSound
;
static
Sound
deathSound
;
static
Sound
deathSound
;
...
@@ -218,7 +218,9 @@ void InitGame(void)
...
@@ -218,7 +218,9 @@ void InitGame(void)
recTab
[
7
].
height
=
(
SQUARE_SIZE
)
-
0
.
1
;
recTab
[
7
].
height
=
(
SQUARE_SIZE
)
-
0
.
1
;
}
}
highscore
=
LoadStorageValue
(
0
);
if
(
level
==
2
){
highscore
=
LoadStorageValue
(
1
);
}
else
highscore
=
LoadStorageValue
(
0
);
//sons
//sons
fruitSound
=
LoadSound
(
"SnakeSounds
\\
shroom.mp3"
);
// Load audio files
fruitSound
=
LoadSound
(
"SnakeSounds
\\
shroom.mp3"
);
// Load audio files
...
@@ -481,9 +483,13 @@ void DrawGame(void)
...
@@ -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
(
"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
);
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
(
highscore
<
snake
[
0
].
score
){
SaveStorageValue
(
0
,
snake
[
0
].
score
);
if
(
level
==
2
){
highscore
=
LoadStorageValue
(
0
);
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
);
DrawText
(
TextFormat
(
"HIGHSCORE: %04i"
,
highscore
),
screenWidth
/
2
-
MeasureText
(
"HIGHSCORE: 0000"
,
60
)
/
2
,
screenHeight
-
100
,
60
,
RED
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment