This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
Mathiiii
wrote ...
2019/4/18
How do you let an object follow another object?
Mathiiii
2019/4/18
#
Hello I need to program for school a game that's kind of like Snake. One object called Punkt must follow the other object called Kopf. How do I do that?
danpost
2019/4/18
#
Mathiiii wrote...
One object called Punkt must follow the other object called Kopf. How do I do that?
If you have a reference to the
Kopf
object:
Actor kopf = ...;
you can use:
turnTowards(kopf.getX(), kopf.getY());
to have the
Punkt
object face in the direction in needs to move in.
Mathiiii
2019/4/25
#
Thanks!
You need to login to post a reply.
X