I'm trying to code the classic snake game, but I'm having these problems:
1. How do I make the body grow using just one sprite as the body?
2. How do I make the body sprite know to appear behind the head?
3. How do I make the body segments follow the segment ahead's movements?
The snake head, body and pellets in my project are just one pixel pieces, I don't need to make it more complex than that.
Offline
You'll need lists and stamping. The list length should remain the same as a variable value. That variable should change whenever you pick something up, or just with time. Your stamping script should have this repeated a good number of times (64+)
set # to 0 (don't repeat this line)
if (#<length): (length should be your variable for the length of the snake)
change # by 1
go to (x: item # of (x) ) (y: item # of (y) ) (x and y are two lists that store every body segment)
stamp
end if
If that isn't quite as helpful as you wanted, I'll make a sample project.
Last edited by AtomicBawm3 (2011-06-08 11:43:00)
Offline