Saint Louis University |
Computer Science 144
|
Dept. of Math & Computer Science |
For this assignment, you must work individually in regard to the design and implementation of your project.
Please make sure you adhere to the policies on academic integrity in this regard.
You are to design an interactive sketch depicting the horizon. The top half of the sketch will represent the sky and the bottom half the ground. The exact y-coordinate of the horizon should be a variable in your code. This will be a horizon line at which all objects appear to vanish in the distance. Color and decorate the top and bottom of your sketch appropriately. You are welcome to have distant aspects of the ground, such as a mountain, cross the horizon if you choose.
Your sketch must be interactive, as follows. When the user clicks on the sketch, you are to draw one of two types of objects. If the click occurs in the sky (i.e., above the horizon line), draw an object that belongs in the sky at that point (e.g., a cloud, bird, plane, hot-air baloon, ...). Alternatively, if the click is below the horizon, draw something that belongs on the land (i.e., an animal, flower, building, ...). The size of the added objects should depend upon the distance from the mouse click and the horizon, such that items shrink to near zero size as they approach the horizon.
For the sake of creativity, your objects and landscape for this project should be different from anything you may have created for the first project.
Your sketch must meet the following technical requirements:
You should use the following structure for your program.
// Header comments // Declare global variables void setup() { // Set up the drawing. // Draw the sky and the ground } void draw() { /* remains empty */ } void mousePressed() { // Use the mouseY position to decide whether drawing on sky or on ground // Compute scale factor and call appropriate drawing function. } // You may rename this function, depending on what you choose as your sky object void drawCloud( int x, int y, float factor ) { // Draw a cloud at the given coordinates using scale factor. } // You may rename this function, depending on what you choose as your sky object void drawFlower( int x, int y, float factor) { // Draw a flower at the given coordinates using scale factor. }
Please see details regarding the submission process from the general programming web page, as well as a discussion of the late policy.
For this project, we ask that you submit the following three files:
save("filename.jpg"); // or any other such filenameperhaps when a particular key is pressed, so that you can wait to generate the image until after you add several examples of your objects.
The assignment is worth 70 points, which will be assessed as follows: