From 9afeb8563515a9952fc249018318889bc63bbdc7 Mon Sep 17 00:00:00 2001 From: Hanse-14 Date: Mon, 11 Dec 2023 12:45:47 +0100 Subject: [PATCH] Add startposition in mid of map --- src/snake.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/snake.c b/src/snake.c index b348b27..cf4d1e8 100644 --- a/src/snake.c +++ b/src/snake.c @@ -14,17 +14,17 @@ void snakeInit() game.snake.length = config.snakeDefaultLength; // coordinates of head - game.snake.headX = 5; - game.snake.headY = 5; + game.snake.headX = game.map.width / 2; + game.snake.headY = game.map.height / 2; // movement direction game.snake.direction = 3; // left // coordinates of tail - game.snake.tail[0][0] = 5; // X-coordinate - game.snake.tail[0][1] = 5; // Y-coordinate - game.snake.tail[1][0] = 4; // X-coordinate - game.snake.tail[1][1] = 4; // Y-coordinate + game.snake.tail[0][0] = game.snake.headX; // X-coordinate + game.snake.tail[0][1] = game.snake.headY; // Y-coordinate + game.snake.tail[1][0] = game.snake.headX - 1; // X-coordinate + game.snake.tail[1][1] = game.snake.headY - 1; // Y-coordinate // alive game.snake.isAlive = true;