Methods and Functions Flashcards

1
Q

Check if the right keyboard arrow has been pressed

A

if (Greenfoot.isKeyDown(“Right”))
{

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Make an object point right

A

setRotation (0);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Make an object point down

A

setRotation (90);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Make an object point left

A

setRotation (180);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Make an object move forward 1 space

A

move (1);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Make an object point up

A

setRotation (270);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

play a sound file called “pop.wav”

A

Greenfoot.playSound (“pop.wav”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Generate a random number between 0-100

A

Greenfoot.getRandomNumber (100);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Return a true / false value when an object is at the edge of the world

A

if (isAtEdge())
{
returnFalse
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Make an object turn 45 degrees

A

turn (45);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Return true or false if the object is touching another (e.g. touching an object of a class called “Snake.class”)

A

if (isTouching(Snake.class))
{

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Remove an object from the game world that the object is touching (for example, Heart.class)

A

removeTouching(Heart.class);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Stop code

A

Greenfoot.stop();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Add 1 to the counter from another character

A

Counter counter = (Counter)getWorld().getObjects(Counter.class.get(0));
counter.add(1);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly