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

2013/10/23

How do you make objects attract?

mauz.asghar mauz.asghar

2013/10/23

#
Hey, im trying to get an object to always go where another object is if anybody any clue of how can I do this please help.
danpost danpost

2013/10/23

#
If you give the object that follows a reference to the object that it follows, you can use
if (followed.getWorld() != null) setLocation(followed.getX()+0, followed.getY()-30);
I gave it an offset of (0, -30) from where the followed object is location (which would be a little above the object), but you can make it whatever you want.
mauz.asghar mauz.asghar

2013/10/28

#
Thank you so much. Really appreciate it.
You need to login to post a reply.