From 7779881cc9f3ec8ac3bb44e185554745afd0416b Mon Sep 17 00:00:00 2001 From: TriantaTV <56975502+TriantaTV@users.noreply.github.com> Date: Wed, 10 Aug 2022 19:59:48 -0500 Subject: [PATCH] Fixed comments and added to gitignore --- .gitignore | 1 + src/Snake.cpp | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4692a68..7a93400 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ *.out *.app *.json +*.ps1 diff --git a/src/Snake.cpp b/src/Snake.cpp index ded4b4c..30db46e 100644 --- a/src/Snake.cpp +++ b/src/Snake.cpp @@ -19,7 +19,7 @@ bool SnakeCollision(sf::RectangleShape object1, sf::RectangleShape object2) } -// Move snake head piece +// Check keyboard for new direction of snake void Snake::CheckDirection() { if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) @@ -74,9 +74,8 @@ void Snake::MoveSnake(sf::RectangleShape& snakeFood) newHeadPosition = CalculateNewPosition(snakeDirection, newHeadPosition); sf::RectangleShape newBodyPart(sf::Vector2f(25,25)); newBodyPart.setPosition(newHeadPosition); - if (IsSelfCollision(newBodyPart)) + if (IsSelfCollision(newBodyPart)) // Do nothing if self collision { - // Do nothing if self collision return; } newBodyPart.setFillColor(sf::Color::Green);