Move via arrow key
If (Greenfoot.isKeyDown(“ ”)) {
setLocation( getX(), getY());
}
Turn when at edge
If (isAtEdge()) {
Turn(180);
Move(10);
}
Make an object move randomly
move(Greenfoot.getRandomNumber(10));
turn(Greenfoot.getRandomNumber(180) -90);
Eat
If (isTouching(car.class)) {
getWorld().removeObject(this);
}
Play sound
Greenfoot.playSound(“pop.wav”)
Stop
Greenfoot.stop();
Counter
Counter counter = (Counter)getWorld().getObjects(Counter.class) .get(0);
counter.add(1);
Sensible size for a word
(100, 100, 4)
What is an assignment
Giving something a value
What is a selection
if statement
Example of a superclass
World
Actor
Example of an inherited class.
World —> ground
What is a parameter
It is anything inside the bracket
What is method
Public void act
Example of a private property
counter (LOWER case ONLY)
Examplm of a parameter
Amount