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

2016/4/7

Actor follow same direction as another

Maimoce Maimoce

2016/4/7

#
How can I make an actor follow the same direction as another? More specifically I would like an asteroid (class) follow the same direction as the bullet (class) when hit.
Super_Hippo Super_Hippo

2016/4/8

#
Do you mean that if a bullet is flying to the right side, the asteroid should go to the right side after the bullet hits the asteroid? So like this?
Actor asteroid = (Actor) getOneIntersectingObject(Asteroid.class);
if (asteroid != null)
{
    asteroid.setRotation(getRotation());
    getWorld().removeObject(this);
}
You need to login to post a reply.