After burning my brain a little bit I finally got some good results with my code.
To give you guys a context:
The player must collect the "eggs" that are at the screen. When the player touches an egg, it starts following the player.
Touching a second egg, it follows the first egg, the third follows the second, etc.
But I feel that there is a way to do some refactoring to the "Follow Player" part, but I have no idea how to do it. So I'm here to ask you guys, what can I do to improve it?
The code, so far:
Here's the demo: http://dl.dropbox.com/u/12937330/follow_test/index.html
Thanks in advance!