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

2016/4/13

How do I turn an actor without rotating their image?

bintin125 bintin125

2016/4/13

#
Whenever I try to turn my actor to the left, it also rotates the image. How do I stop the image from rotating?
danpost danpost

2016/4/13

#
Maintain a zero rotation by saving the direction of movement in a field:
1
2
3
4
5
6
7
8
9
// instance field
private int rotation;
 
// before turning and moving
setRotation(rotation);
 
// after turning and moving
rotation = getRotation();
setRotation(0);
You need to login to post a reply.