Over the past several classes, we've discussed the implementation of the Cannonball game. In this game, you have a cannon with 15 cannon balls and a target that moves back and forth along the ground. You can control the angle of the cannon by clicking and dragging anywhere on the screen. When a key is pressed, a cannon ball fires (at the current angle of the barrel). If the ball lands on the target, a point is added to the player's score (indicated in the second row of small rectangles, in the top left of the screen). When all remaining balls have been fired (indicated by the top row of small rectangles), the game is over.
In the past week, we've learned how to use function definitions and calls in combination with problem simplification, rapid prototyping, and incremental development to aid in the construction of substantial programs. We have also seen how to model some complex forms of motion (such as projectile motion), and how to use functions (both definitions of new ones and calls to existing ones) to solve reasonably complex modeling problems (such as projectile motion and angles between points).
Time to fly. Apply your hard-won new skills, employ the example code we've developed, and build your own version of this game.
As long as your game has a mouse-controlled cannon angle, correct projectile motion, a horizontally moving target, and a scoreboard, you may vary the appearance any way you like. Load an image fil for your background! Or load small images for the cannon balls themselves (bugs, footballs, supernovae, kittens, head, etc.), Change the colors. Present the scoreboard vertically (or present one vertically, the other other horizontally).
Use your imagination!
Submit the folder containing your Processing sketch. This should be a single folder named "project1", which will contain your Cannonball game. You do not need to submit a paper printout of anything. Again, the turnin directory is
You may re-submit this work as many times as you like, up to the due date/time. Anything submitted after 2:59 pm on Wednesday 10/09 will be considered late (and every file contains a time stamp).
Your code must be syntactically correct. Any solution that contains a syntax error anywhere (and hence crashes when you hit the "play" button") will receive no credit.
If you run into any trouble here, please ask me or one of the TAs for help.
Naturally, your code must be behaviorally correct, though partial credit is always given for partial solutions.