Greenfoot Flashcards
Check if the right keyboard arrow has been pressed
if (Greenfoot.isKeyDown(“right”))
{}
Make an object point right
setRotation(180);
Make an object point down
setRotation(90);
Make an object point up
setRotation(270);
Make an object point left
setRotation(0);
Make an object move forward 1 space
move(1);
Play a sound file called “pop.wav”
Greenfoot.playSound(“pop.wav”);
Generate a random number between 0-100
Greenfoot.getRandomNumber(100);
Return a true / false value when an object is at the edge of the world
if (isAtEdge()) {}
Make an object turn 45 degrees
turn(45);
Return true or false if the object is touching another (e.g. touching an object of a class called “Snake.class”)
if (isTouching(Snake.class)) {}
Remove an object from the game world that the object is touching (for example, Heart.class)
removeTouching(Apple.class);
Stop the program
Greenfoot.stop();