Active Learning: A Soccer Game
Create an animation in Alice that does the following:
Two boys are practicing their soccer in the park. Repeat the following 3 times using procedures and functions where appropriate:
- Boy1 makes kicking motion and says “1” (the first time)
- Ball is moved a random distance between half the distance between the two boys and the full distance between the boys.
- Boy2 moves to the ball and makes a kicking motion and says “2” (the first time)
- Ball is moved a random distance between half the distance between the two boys and the entire distance between the two boys.
- The boys will say back and forth, "1", "2", "3", "4" . . . until they reach "6".
- If at the end, the boys are within 1 meter of each other, they both say "We won!" Otherwise they both say "We need more practice!" This requires an if/else block!
Specifications:
- Make sure the boys and the ball don’t collide with each other (use math operators for precise calculation of the distance between the front of the ball and the front of the other boy).
- Use props to fill out the scene.
- Use at least two variables
- Use repetition and selection control statements.
- Use procedures and functions where appropriate.
Suggestions: This is a longer program than previous ones.
- Get one piece at a time to work, then save. Start here:
public void myFirstMethod() {
//Programmer : _____
//Project : Soccer Game
Integer counter = 0;
/*do in order*/
{
while ( counter < 6 ) {
counter = counter+1;
this.player1.say( ""+counter );
counter = counter+1;
this.player2.say( ""+counter );
}
}
- Keep working on it one piece at a time.
- If you are having problems with one piece, disable those statements and come back to it.
soccermatch.pdf
Active Learning Index