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

2021/3/11

Hi

amilsameer amilsameer

2021/3/11

#
Hi, how can i rotate an object so that when i click run it faces up. Thank you. Additional information: i am a bit new and i want to learn some of the main basics and stuff. this time im trying to make a rocket which is going to fly upwards when i click run. please help and no hate.
danpost danpost

2021/3/11

#
Here are two ways: (A) add a constructor to the Rocket class:
public Rocket()
{
    setRotation(270);
}
or (B) rotate the Rocket object after creating it in your World subclass:
Rocket rocket = new Rocket();
rocket.setRotation(270);
amilsameer amilsameer

2021/3/11

#
danpost wrote...
Here are two ways: (A) add a constructor to the Rocket class:
public Rocket()
{
    setRotation(270);
}
or (B) rotate the Rocket object after creating it in your World subclass:
Rocket rocket = new Rocket();
rocket.setRotation(270);
thanks i didnt understand the topic quite clearly can you telll me it in a more simplified way, sorry im new. Thanks
danpost danpost

2021/3/11

#
A zero rotation is always to the right. Rotation increases as you go clockwise. To "face" upward, an object must be turned three quarters the way around clockwise (3/4 of 360, 360 being a full circle, is 270). So setting an actor's rotation to 270 will have it face, or point, upward.
amilsameer amilsameer

2021/3/11

#
danpost wrote...
A zero rotation is always to the right. Rotation increases as you go clockwise. To "face" upward, an object must be turned three quarters the way around clockwise (3/4 of 360, 360 being a full circle, is 270). So setting an actor's rotation to 270 will have it face, or point, upward.
Thank you DANPOST really appreciate it :)
amilsameer amilsameer

2021/3/11

#
danpost wrote...
A zero rotation is always to the right. Rotation increases as you go clockwise. To "face" upward, an object must be turned three quarters the way around clockwise (3/4 of 360, 360 being a full circle, is 270). So setting an actor's rotation to 270 will have it face, or point, upward.
OMG THANQ IT WORJKER HSDDHSSAHHSHS
You need to login to post a reply.