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:
<img src="http://i10.photobucket.com/albums/a126/shinobi_br/my_code_zps4c48e0ea.jpg" border="0" />
Here's the demo: dl.dropbox.com/u/12937330/follow_test/index.html
Thanks in advance!