Discuss Scratch

LAMAR__44
Scratcher
2 posts

How do I make my snake die when touching itself

I'm trying to make my snake die when it touches itself. Can anyone help? Here's my project by the way https://scratch.mit.edu/projects/239544972/
deck26
Scratcher
1000+ posts

How do I make my snake die when touching itself

No need to set the direction to the current direction when a key press is doing nothing - just use if not direction = value instead of using if/then/else.

If you're going to use clones for this you can't really use touching sprite for detecting when you hit another part of the snake. So it starts getting more complicated. One option would be to move another sprite first to see if it you'll end up touching the snake.

Personally I much prefer a grid system for this kind of game - see my projects
https://scratch.mit.edu/projects/42045208/
https://scratch.mit.edu/projects/47154008/
https://scratch.mit.edu/projects/47150778/

Last edited by deck26 (Aug. 19, 2018 12:51:20)

LAMAR__44
Scratcher
2 posts

How do I make my snake die when touching itself

Thanks, this helped me out a lot!
s246054
Scratcher
3 posts

How do I make my snake die when touching itself

but how can you make it get game over with with clones


Wyan100
Scratcher
1000+ posts

How do I make my snake die when touching itself

s246054 wrote:

but how can you make it get game over with with clones

Mabe you should make a new topic instead of asking on one that's 2 years old.
It5MeCohen
Scratcher
2 posts

How do I make my snake die when touching itself

s246054 wrote:

but how can you make it get game over with with clones


Easy, use broadcasting, then make it so that you somehow die, but then it will broadcast a message, then you can create a death screen sprite, then make the screen recieve the message, then appear
Dharshan20
Scratcher
4 posts

How do I make my snake die when touching itself

yeh i made a snake game and i couldn't figure out how to make it die when it touches itself either??
CheckPasswrd
Scratcher
7 posts

How do I make my snake die when touching itself

bru ik im 3 years late but i still cant make it die I used clones and I cant make it die pls help
deck26
Scratcher
1000+ posts

How do I make my snake die when touching itself

CheckPasswrd wrote:

bru ik im 3 years late but i still cant make it die I used clones and I cant make it die pls help
So create your own new topic and share the project please.
willma02496
New Scratcher
1 post

How do I make my snake die when touching itself

i know im 4 years late but i cant figure it out either
Tunde123
Scratcher
1000+ posts

How do I make my snake die when touching itself

willma02496 wrote:

i know im 4 years late but i cant figure it out either
Do not necropost.
YeeterTheCreeter22
Scratcher
30 posts

How do I make my snake die when touching itself

Try doing something like this:

whenclickedforeveriftouchingcolorSnakeColor?thenbroadcastSnakeDie

Last edited by YeeterTheCreeter22 (March 1, 2022 19:25:15)

Jereb-co7
Scratcher
100+ posts

How do I make my snake die when touching itself

YeeterTheCreeter22 wrote:

Try doing something like this:

whenclickedforeveriftouchingcolorSnakeColor?thenbroadcastSnakeDie
do not necropost

Powered by DjangoBB