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

2016/11/15

how to change the direction of moving forward?

Sk1llG4m3r Sk1llG4m3r

2016/11/15

#
when i move it moves to the left but when i turn it also turns the freaking picture how can i trun without turning the Picture
danpost danpost

2016/11/15

#
You can use the 'setLocation' method for movement or you can save the rotation in a field and set the actor to that rotation at the beginning of the act method and save it and reset the rotation back to zero at the end of it:
// instance field
private int rotation;

public void act()
{
    setRotation(rotation);
    // current code in act
    rotation = getRotation();
    setRotation(0);
}
You need to login to post a reply.