pinak22dhir / Python-Gamez-Arena

MIT License
11 stars 25 forks source link

Fixed collisions #45

Closed fricelis closed 8 months ago

fricelis commented 9 months ago

fixed issue #27

🛠️ Fixes Issue: Collisions

Type of change ✍️

👨‍💻 Changes proposed:

In the play method of your Game class, I changed the starting index of the loop that checks for collisions between the snake’s head and its body.

Originally, your code started checking for collisions from the third segment of the snake’s body (for i in range(3, self.snake.length)). This means that when the length of the snake is less than 3, the collision detection with the snake’s body is not performed.

I modified this to start checking from the first segment of the snake’s body instead (for i in range(1, self.snake.length)). This ensures that the collision detection with the snake’s body is always performed, regardless of the length of the snake.

✔️ Check List (Check all the applicable boxes)

đź“· Screenshots

N/A

đź“„ Note to reviewers

N/A