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
43451d8c
Commit
43451d8c
authored
4 years ago
by
Benjamin LEROUX
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fonctionnalité des murs téléporteurs
parent
6e7534ae
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
snake.c
snake.c
+21
-0
No files found.
snake.c
View file @
43451d8c
...
...
@@ -23,6 +23,12 @@
#define SNAKE_LENGTH 256
#define SQUARE_SIZE 31
//----------------------------------------------------------------------------------
// More Defines
//----------------------------------------------------------------------------------
#define BordureX 12.5
#define BordureY 8
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
...
...
@@ -188,12 +194,27 @@ void UpdateGame(void)
}
// Wall behaviour
/*
if (((snake[0].position.x) > (screenWidth - offset.x)) ||
((snake[0].position.y) > (screenHeight - offset.y)) ||
(snake[0].position.x < 0) || (snake[0].position.y < 0))
{
gameOver = true;
}
*/
//teleport wall
if
((
snake
[
0
].
position
.
x
)
>
(
screenWidth
-
offset
.
x
)){
snake
[
0
].
position
=
(
Vector2
){
offset
.
x
/
2
,
snake
[
0
].
position
.
y
};
}
else
if
((
snake
[
0
].
position
.
x
)
<
0
){
snake
[
0
].
position
=
(
Vector2
){
screenWidth
-
(
offset
.
x
/
2
)
-
SQUARE_SIZE
,
snake
[
0
].
position
.
y
};
}
else
if
((
snake
[
0
].
position
.
y
)
>
(
screenHeight
-
offset
.
y
)){
snake
[
0
].
position
=
(
Vector2
){
snake
[
0
].
position
.
x
,
offset
.
y
/
2
};
}
else
if
((
snake
[
0
].
position
.
y
)
<
0
){
snake
[
0
].
position
=
(
Vector2
){
snake
[
0
].
position
.
x
,
screenHeight
-
(
offset
.
y
/
2
)
-
SQUARE_SIZE
};
}
// Collision with yourself
for
(
int
i
=
1
;
i
<
counterTail
;
i
++
)
...
...
This diff is collapsed.
Click to expand it.
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