greenfoot Flashcards

1
Q

what does round brackets mean?

A

they are used in mathematical expressions, and to surround the parameter lists for method calls

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

what does curly brackets mean?

A

these are used to surround blocks of code, such as methods or the contents of classes.

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

what does square brackets mean?

A

they are used for arrays.

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

what does compile mean?

A

compile combines the different classes and subclasses onto the world, we must compile the classes before we run the program otherwise it wouldn’t work, if we don’t compile the classes, they are unable to go on the world

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

what does move() mean?

A

allows the classes/objects to move and the number inside the brackets dictates how far it moves each click

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

what does SetRotation() mean

A

allows the classes/objects to turn and the number inside the bracket dictates how far it turns

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

what does if() mean?

A

this works the same way an if statement does in python for example if the down key is pressed it will move down (if that’s how you have programmed it)

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

whats does Greenfoot.isKeyDown(“left”) mean?

A

if the left arrow key is pressed the classes/ object will turn left

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

how would you make the classes turn right and move?

A

if (Greenfoot.isKeyDown(“right”))
{
setRotation(0);
move(1);
}

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

how would you make it so that if your main character touches a specific actor, the specific actor will disappear?

A

if(isTouching(cherry.class))
{
removeTouching(cherry.class);
}

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

how do you add a counter so that when the cherry disappears a point is added to this previous piece of code?

A

if(isTouching(cherry.class))
{
removeTouching(cherry.class);
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
12
Q

how would the code look if you wanted to change it so that when the plum disappears a point is deducted

A

if(isTouching(plum.class))
{
removeTouching(plum.class);
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
13
Q

how do you make your actor turn at random

A

move(1);
if (Greenfoot.getRandomNumber(10)<1)
{
turn(Greenfoot.getRandomNumber(90)-45);
}

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

how would you play a sound when a cherry is removed

A

if(isTouching(cherry.class))
{
removeTouching(cherry.class);
Greenfoot.playSound(“sound2.mp3”);
}

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