greenfoot Flashcards

1
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
2
Q

what does move() mean

A

allows the classes/objects to move and the number inside the brackets dictates how far they move

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

what does turn() mean

A

allows the classes 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
4
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
5
Q

how do you make your actor move 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
6
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
7
Q

how do you add a counter 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
8
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
9
Q

what does curly brackets mean

A

these are used to surround blocks of code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
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
11
Q

how do you make your actor turn at random

A

move(1);
if (Greenfoot.getrandomnumber(10)<1)

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