CST112 Project 4: Chapter 5
-
Design some object of your own (this should be a different object than the ones
you created for Projects 1, 2 and 3) that moves around the Processing output window
as follows:
-
The size of the output window should be 300 by 400 pixels; however you
should use the system variables
height
and width
in any calculations and conditions so that all elements of the application
should function the same way no matter what size the output window
-
The object should move both horizontally and vertically as well; when it
reaches any of the output window borders it should reverse direction; for
example if it reaches the left or right border, it should change direction
horizontally; if it reaches the top or bottom border, it
should change direction vertically (click the "Play
Project 4" link below)
(
You can receive a maximum of 8 out of 10 points if you
complete this much of the assignment successfully
)
-
For "additional points" do any or all of the following:
-
For an additional ½ point of credit,
set different colors for a major element in your object depending
upon its location in one of the four quadrants of the output window;
for example:
-
If it is in the upper-left quadrant of the output window, the
color is red
-
If it is in the upper-right quadrant of the output window, the
color is green
-
If it is in the lower-left quadrant of the output window, the
color is blue
-
If it is in the lower-right quadrant of the output window, the
color is black
This is just a suggestion as demonstrated in the "Play Project 4" link below;
you may use your creativity to implement this element in any way that you prefer
-
For an additional ½ point of credit,
change the shape of a major element in your object depending upon its location
in one of the two halves of the output window; in the example:
- If in the upper half of the output window, draw a ball
- If in the lower half of the output window, draw a box
This is just a suggestion as demonstrated in the "Play Project
4" link below; obviously you will not draw just a ball and a box
since your object will be more complex than that; use your creativity
to implement this element in any way that you prefer
-
For an additional ½ point of credit,
add a variable of type
boolean
to the application that
controls the background color; the first time the mouse button is
clicked, the background turns to a different color; the next time
the mouse button is clicked, the background returns to its original
color; this functionality continues to reverse each time the mouse
button is clicked; update the value of the boolean variable in the
mousePressed()
method; alternately you may choose to
use two background images and vary between the two each time the
mouse is clicked
-
For an additional ½ point of credit,
when the mouse button has been clicked and the background color has
changed to its alternate color (see #3 above), the fill color of the
major area of the object should change to white (or some alternate
color of your choice) only while it is in the lower-right quadrant
(or some other area in the output window of your choice); when the
mouse button has been clicked again, the object then should return
to its normal color; this functionality continues to reverse each
time the mouse button is clicked
-
Full credit (10 points out of a maximum of ten) will
be given for successfully completing all parts of this assignment
-
Click this Play Project 4
link to view an sample application to see all the different effects
(this is the full credit version with a "Smiley Face")
-
Insert the project number, your name, your e-mail address, the submission
due date and one or two sentences that describe the sketch as comments at
the beginning of the program (the same as you did for Projects 1, 2, and 3);
additionally comment each of the groups of variable declarations as
well as the sections of code
-
Students may work on all projects in teams of two or three,
and, if so, all students in the group must submit the same project to their own dropboxes
in Blackboard. In the text box's dropbox, as well as in the source code documentation
(comments), state the name(s) of the classmate(s) with whom you worked.
-
The completed project archived into a ".ZIP" file submitted
electronically via an attachment to a
Brightspace
dropbox is due to Prof. Struck no later than 11:59 p.m. on the date
listed in the course outline.