Project 3 -- Add bouncing and collision-detection to project 2.
Using the "if" control statements, modify project 2 as follows:
Be sure to display title (at the top) and author (in lower-right corner).
- When the bird reaches the right side, start a new bird
from the left side, at a random height.
(If possible, give the new bird a different, random color and size)
Bird should fly downward when it reaches top of sky,
upward when it hits the ground.
(NOTE: Bird should have both horizontal and vertical velocities, dx and dy.)
If monster catches the hero,
subtract 25 points from the score,
and "reset" positions as follows:
- Move hero into house.
- Move monster to left side of screen, at a random height.
- (Leave gold where it was; wait for mouse click to move the gold.)
When hero reaches the gold, add 10 points to score,
and "reset" positions as above.
Also "reset" positions
when the "r" key is pressed.
- Quit the sketch when the "q" key is pressed.
- Pause the action if "p" was the last key pressed.
- Display instructions if "?" was the last key pressed.
Display the score in black it is positive or red if negative;
if score is zero, do not display it.
If monster gets too near the house, it is repelled away.
(Also flash the screen, when this happens.)
If the mouse is clicked above the horizon (where sky meets ground),
do NOT move the gold;
instead, start a new bird from the left.
Project 2 -- moving creatures, gold, etc. (and monster?)
Create a dynamic sketch using draw() method,
with the following objects displayed on the screen:
Each of these objects has coordinates (x,y) variables,
and may also have velocity (dx,dy) variables.
- A sparkling lump of gold, which moves to a new location, when the mouse is clicked.
- The "hero" (you make up the name!), chases the gold.
- A dog, who follows the hero. (Puppy follows dog?)
- A bird (e.g. blue triangle, flying across the sky)
- Add a monster, to chase the hero.
The scene is a grassy field (occupying most of the sketch),
with a light blue sky above
(and maybe some buildings or hills on the horizon.)
Display title at top
(plus some instructions),
and be sure to display your name (lower-left corner).