From eb2f338cfae34c02ce1ec1997d5f61fb8e50eef7 Mon Sep 17 00:00:00 2001 From: Sumer Shinde Date: Tue, 12 Nov 2024 17:01:15 -0500 Subject: [PATCH] Changed length of inital snake to 3 --- NERODevelopment/content/Snake.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NERODevelopment/content/Snake.qml b/NERODevelopment/content/Snake.qml index ddfb600..911dce2 100644 --- a/NERODevelopment/content/Snake.qml +++ b/NERODevelopment/content/Snake.qml @@ -33,7 +33,13 @@ Rectangle { Component.onCompleted: startGame() function startGame() { - snakeBody = [{ x: Math.floor(gridWidth / 2), y: Math.floor(gridHeight / 2) }] + let centerX = Math.floor(gridWidth / 2) + let centerY = Math.floor(gridHeight / 2) + snakeBody = [ + { x: centerX, y: centerY }, + { x: centerX - 1, y: centerY }, + { x: centerX - 2, y: centerY } + ] direction = 1 gameOver = false score = 0