Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make it 'Game Over' when snake touches its own body
- joe232133
-
New Scratcher
1 post
How to make it 'Game Over' when snake touches its own body
I can get game over to work when I touch the edge of the screen but I want it to also become game over when the head of the snake touches its own body. How would I do this?
Here is the image
https://i.ibb.co/PW2sYp3/Snake.png
At the moment it will be game over as soon as the game starts as you can see where I have circled in my code.
How would I fix this issue?
Here is my entire project file
https://drive.google.com/open?id=1W9ocPySVGmEJk_GMDr60EdNJkKbEr-Kl
Here is the image
https://i.ibb.co/PW2sYp3/Snake.png
At the moment it will be game over as soon as the game starts as you can see where I have circled in my code.
How would I fix this issue?
Here is my entire project file
https://drive.google.com/open?id=1W9ocPySVGmEJk_GMDr60EdNJkKbEr-Kl
- RokCoder
-
Scratcher
1000+ posts
How to make it 'Game Over' when snake touches its own body
Here's an example Snake project using pen that I wrote a while ago. It tests the distance between the head and each body part to determine if the head has collided with the body. It's one possible solution though there are many others that I'm sure will be suggested 

- Discussion Forums
- » Help with Scripts
-
» How to make it 'Game Over' when snake touches its own body