Commit 43451d8c authored by Benjamin LEROUX's avatar Benjamin LEROUX

Fonctionnalité des murs téléporteurs

parent 6e7534ae
......@@ -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++)
......
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