CST 112
Intro. to Programming
(with Processing/Java)
Final Exam
- In the "Animal" class, add a constructor with a different number of arguments
than any other constructor.
- Add code to the "Animal" class to draw objects with shape = 2 (submarine):
ellipse with rectangle on top, and one pair of "arms".
- Declare a "submarine" object (Animal with shape=2), using your new constructor
Make it move up & down rapidly (dy= +/- 8), left/right slowly (dx= +/- 0.5)
- Add code to move and show the "submarine" in each frame.
Examine the code for the ant object,
(which is an instantiation of the Animal class with and shape 6 and 3 pairs of arms).
When it reaches the surface, it "dies" (change color to gray) and floats there (dy=0).
Then, when it floats off the right edge, a new object is created at the bottom.
-
Create an array of 5 "bugs" (3 armpairs) that behave the same way as "ant".
(See code for ant. Make loops to do the same for each for each bugs[j].
- Add wings to bird - flap them up/down every second.
- Add a second bird, of a different color.
- Activate cat, bird, and sub when clicked. See the code for keyPressed()
- Add a loop to scene() to draw blades of green "grass" across the bottom.
Make the grass lean in the same direction that the cat is moving (cat.dx).
- Add code to display the score, but only when it is not zero..
- Add code to detect crashes and change the score.
Bird eats bug (+25).
Cat catches bird (-100)
Zoog catches bird (+50)
-- ... add two more "crashes"
-- ... and change score when detected.