Greenfoot Flashcards
1
Q
what is the move method?
A
if(Greenfoot.isKeyDown("key name")) { move(amount); or turn(amount(minus for turning right)); }
2
Q
move randomly?
A
if(Greenfoot.getRandomNumber(10) == 1) { turn(Greenfoot.getRandomNumber(360)); } move(amount);
3
Q
remove touching?
A
Actor (actor name) = getOneObjectAtOffset(0, 0, (actor name).class); if (actor name != null) { getWorld().removeObject(actor name); }
4
Q
play a sound?
A
Greenfoot.playSound(“filename.wav”);
5
Q
add a counter?
A
- create a counter class
2. add: ((Counter)getWorld().getObjects(Counter.class).get(0)).add(1); to the class affected by the counter
6
Q
what is a superclass?
A
the class that all the others come from (e.g actor, world)