Problem Set 4
Purpose This problem set concerns the design and
creation of a larger program —
You must follow the design recipe in your solutions: graders will look for data definitions, signatures, purpose statements, examples/tests, and properly organized function definitions. For the latter, you must follow templates. You do not need to include the templates with your homework, however, unless the question asks for it.
Due Friday, June 3nd at 11:59pm.
Problem 1 For this assignment you will develop a game where giraffes kiss!
A similar game can be played here: Casanova.
In this game you play as a giraffe. You can stretch out your neck by clicking the mouse button but when you let go, your neck begins to shrink again. Giraffes of various sizes will walk by and your goal is to kiss them by making your neck the proper height. You gain points for each kiss and you lose a life each time a giraffe passes you without kissing you. We have provided some constants here so that you don’t have to figure out how to draw a giraffe, but you may use your own images if you like.
The main function that runs your game should take in an initial neck height and the number of lives the player has.
Your game should display the player (a giraffe facing to the right), the other giraffes (facing to the left), the score of the player, and the number of lives the player has left.
The player should only be able to kiss a giraffe once and when this happens there should be some indication displayed on the screen (such as a heart above the giraffes).
For bonus points implement a version of the game in which kissing multiple giraffes in a row is worth more points (so kissing the first giraffe is 100 points, then the second giraffe is 200 points, and so on until you miss a giraffe).
You will not receive 100% credit simply for having code that works. For full credit, your code must work and be well written. So you should put your effort into writing clean, readable, bug-free code.
As always, you should use the Design Recipe help get your code written.
You may implement more features, if you like (e.g., fancier scoring, increasing difficulty, game pausing). However, extra features won’t save you from points taken off if your code has bugs or isn’t well written.
Start early. It will take you time to work out the assignment.