CST 112 Exam #1

Starting with a copy of your project #1 code (submitted in your folder on a .pde file named p1) follow the instructions below, and submit your code for this exam on a .pde file named q1. Click this link to view instructions for Project #1:

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;
Of course, your declarations will be different
(using first letters of your own name for "hero" & "dog" -- rather than "Bob" & "Mutt") .
However, there is no need to change any of your variable names!

Please note that modularity and readability are important factors used in grading.
//// EXAMPLE of modularized draw() function ////
void draw() {
    scene();
    action();
    messages();
}
The draw() function should call other functions to do the actual sketching; avoid calling graphics functions such as rect(), ellipse(), triangle(), fill(), etc. from within your draw(...) function.


I N S T R U C T I O N S

Add these features to a copy of your p1 code (as illustrated in the Screen Shots):

Action:  



demo code
For illustration only; do NOT copy this code).

Animation:  

Scene:  

Events: