You should complete the lessons Calculations and Functions and Random Numbers before doing this assignment.
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:
A loop is used to repeat the boys taking turns and counting and kicking:
- 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:
.
Please start with this:
Integer counter = 0;
while ( counter < 6 ) {
counter = counter+1;
// boy1 counts and kicks
counter = counter+1;
// boy2 counts and kicks
}
Make sure that 2 boys alternate counting to 6, then add the kicking which should be a biped procedure.
Don't do the next step until the previous step works correctly.
- 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.
- Note that the distance between the boys has to be calculated before each kick.
- The boys will say back and forth, "1", "2", "3", "4" . . . until they reach "6". Use a variable for this, not a constant.
- 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!"
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.
- 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.
- Save the Alice3 program as LastName_FirstName_soccer.a3p. For example Smith_Mary_soccer.a3p
- Submit the LastName_FirstName_soccer.a3p file in assignments.
The following are requirements:
If any of these requirements are not met, the score will be 0.
If the requirements are met, the grade is as follows:
Possible points=50
If you do not receive a perfect score you may resubmit it as long as it is resubmitted within 3 days.
Assignment IndexThis web site, and all pages therein, are the sole property and responsibility of Zebra0.com.
It is not endorsed, sponsored, or provided by or on behalf of Montgomery College.