From c03b16f0e9bd5ad17a8b80d7b29feb03c28b9eed Mon Sep 17 00:00:00 2001 From: TriantaTV <56975502+TriantaTV@users.noreply.github.com> Date: Mon, 25 Jul 2022 16:12:11 -0500 Subject: [PATCH] Laid groundwork for creating a snake body Laid groundwork for creating a snake body. Implementation should be added and working next push. --- src/Snake.cpp | 20 ++++++++++---------- src/Snake.h | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Snake.cpp b/src/Snake.cpp index 8e127ba..fb5821e 100644 --- a/src/Snake.cpp +++ b/src/Snake.cpp @@ -26,33 +26,33 @@ void SnakeMovement(sf::Keyboard keyboard) /* if (keyboard.pressed(Left)) snakeHead.moveleft(); - if (keyboard.pressed(Right)) snakeHead.moveRight(); if (keyboard.pressed(Down)) snakeHead.moveDown(); if (keyboard.pressed(Up)) snakeHead.moveUp(); - if (!snakeHead.isTouchingFood()) - snakeQueue.pop(); - */ return; } void Snake::ExtendSnake() { - /* - snakeBody.push_back(newLocation); - */ + // Create a new deque RectangleShape without popping old return; } void Snake::MoveSnake() { - /* - head.snakeBody() - */ + // Create a new deque RectangleShape and pop old + // Todo: Depreciate ExtendSnake and just add a collision test + return; +} + +Snake::Snake() +{ + // Possibly unnecessary + // The big 3 could be used to create a fresh game state return; } // SnakeNode::SnakeNode(); diff --git a/src/Snake.h b/src/Snake.h index 7299cfd..8bf2632 100644 --- a/src/Snake.h +++ b/src/Snake.h @@ -21,6 +21,7 @@ class Snake { private: std::deque snakeBody; + Snake(); public: // Instead of popping like in MoveSnake() // Simply add to deque