Global variables in project #1 were similar to this example:
//// GLOBAL DECLARATIONS //// // (x,y) coordinates of hero, dog, etc. float bobX, bobY, bobXspeed, bobYspeed; float muttX, muttY; float cyclopsX, cyclopsY; float sunX, sunY, houseX, houseY, treeX, treeY, horizon; int score=0; |
Please note that modularity and readability are important factors used in grading.
//// EXAMPLE of modularized draw() function //// void draw() { scene(); action(); messages(); } |
Add these features to a copy of your p1 code
Action:
demo code
For illustration only; do NOT copy this code).
Animation:
Scene:
Events:
| Action: |
---|---|
'd' | Change to day |
'n' | Change to night |
'r' | Reset:
|
'q' | Quit. |
'b' |
EXTRA CREDIT:
When 'b' key is pressed, a from beneath the sun, going faster and faster until it reaches the bottom or hists something.
If it hits the monster, add 5 points to score |
Be sure to save your code in your folder (as q1.pde) before you leave class, today.
Takehome Exam "r1"Starting with a copy of your exam code q1 revise and improve the code, as necessary, and submit it |
20303