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

2012/11/22

Snake and smoothmover

Malmotri Malmotri

2012/11/22

#
I wonder if anyone knows how to implement so my snake move smoother? I have tried to use smoothmover but haven't succeeded making it work. This is a link to my scenario. http://www.greenfoot.org/scenarios/6712
danpost danpost

2012/11/22

#
The smoothmover class does fine when working with one single actor; but when using multiple actors (as with a snake's segments), it would probably require taking the distance between each pair of joined segment and subtracting a specific gap between the two segments, turn the aft segment toward the fore segment and move it the remaining distance. Actually, being the fore segment will have already been moved, you will have to pass where it started (saving that location before it moves) to the aft segment so it could turn and move toward that location.
Malmotri Malmotri

2012/11/23

#
Okay, that may be little to advanced for me right now. But thanks!
actinium actinium

2012/11/24

#
i quite like your snakes movement.
You need to login to post a reply.