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
e2285cd3
Commit
e2285cd3
authored
Oct 27, 2020
by
Benjamin LEROUX
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gestion highscore
parent
15e6d0a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
snake.c
snake.c
+11
-2
No files found.
snake.c
View file @
e2285cd3
...
@@ -65,6 +65,7 @@ static Food goldenFruit = {0};
...
@@ -65,6 +65,7 @@ static Food goldenFruit = {0};
static
Food
deadFruit
=
{
0
};
static
Food
deadFruit
=
{
0
};
static
Rectangle
recTab
[
NUMBEROFWALL
];
static
Rectangle
recTab
[
NUMBEROFWALL
];
static
int
highscore
;
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
// Module Functions Declaration (local)
// Module Functions Declaration (local)
...
@@ -195,6 +196,8 @@ void InitGame(void)
...
@@ -195,6 +196,8 @@ void InitGame(void)
recTab
[
7
].
y
=
screenHeight
-
(
offset
.
y
/
2
)
-
(
3
*
SQUARE_SIZE
);
recTab
[
7
].
y
=
screenHeight
-
(
offset
.
y
/
2
)
-
(
3
*
SQUARE_SIZE
);
recTab
[
7
].
width
=
(
SQUARE_SIZE
*
3
)
-
0
.
1
;
recTab
[
7
].
width
=
(
SQUARE_SIZE
*
3
)
-
0
.
1
;
recTab
[
7
].
height
=
(
SQUARE_SIZE
)
-
0
.
1
;
recTab
[
7
].
height
=
(
SQUARE_SIZE
)
-
0
.
1
;
highscore
=
LoadStorageValue
(
0
);
}
}
void
drawWalls
(){
void
drawWalls
(){
...
@@ -421,8 +424,14 @@ void DrawGame(void)
...
@@ -421,8 +424,14 @@ void DrawGame(void)
}
}
else
{
else
{
DrawText
(
"PRESS [ENTER] TO PLAY AGAIN"
,
screenWidth
/
2
-
MeasureText
(
"PRESS [ENTER] TO PLAY AGAIN"
,
40
)
/
2
,
screenHeight
-
200
,
40
,
BLACK
);
DrawText
(
"PRESS [ENTER] TO PLAY AGAIN"
,
screenWidth
/
2
-
MeasureText
(
"PRESS [ENTER] TO PLAY AGAIN"
,
40
)
/
2
,
screenHeight
-
200
,
40
,
BLACK
);
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
){
SaveStorageValue
(
0
,
snake
[
0
].
score
);
highscore
=
LoadStorageValue
(
0
);
}
DrawText
(
TextFormat
(
"HIGHSCORE: %04i"
,
highscore
),
screenWidth
/
2
-
MeasureText
(
"HIGHSCORE: 0000"
,
60
)
/
2
,
screenHeight
-
100
,
60
,
RED
);
}
}
EndDrawing
();
EndDrawing
();
}
}
...
...
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