Right-click on your main character class and select ' Open editor '.
The editor allows you to write different methods - actions that the class can perform.
The act() method will repeat whenever the Run button is pressed.
You need to use an if statement to check if a certain key (like the right arrow key) is being pressed down .
An if statement must be contained in standard brackets . After each if statement, the proceeding code must be typed within curly brackets - see the image on the left .
Tip - If the brackets are on the same line then use the standard brackets ( and )
If the brackets are on different lines then use curly brackets
Your code must be perfect or it won't work. ' Greenfoot ' requires a capital G and the isKeyDown method most be written with a lowercase i but uppercase K and D .
When the right arrow key is pressed the object will change its rotation to 0° which is right . It will also move 1 place in this direction.
Rotations in Greenfoot: