This site requires JavaScript, please enable it in your browser!
Greenfoot back
ZOE
ZOE wrote ...

2015/3/12

How can i make a list with body parts of a snake in the World?

ZOE ZOE

2015/3/12

#
I have 4 images (head, bodyPart, curvebodyPart and tail) and i want to make my snake with that but looks like i never find the right answer. Someone can help me?
danpost danpost

2015/3/12

#
I suggest that you make your snake "move" by adding segments behind the head and removing the segment ahead of the tail and moving the tail to the position it was at. That way you only have to decide what image to make each segment once. The direction the head moves determines which image to give to the new segment behind it. If and when the snake grows in length, only move the head and add the new segment; do not move the tail and remove the one in front of it. DEMO:
TAIL   SEG1   SEG2   SEG3   SEG4   SEG5   HEAD
       TAIL   SEG2   SEG3   SEG4   SEG5   SEG6   HEAD
              TAIL   SEG3   SEG4   SEG5   SEG6   SEG7   HEAD
              TAIL   SEG3   SEG4   SEG5   SEG6   SEG7   SEG8   HEAD // growth
You need to login to post a reply.