CST112 Test #1
Using the Processing language, create a new sketch as described below.
(You may use code from previous projects and practice sketches.)
When you are done, paste your code into a file named "test1.pde"
and upload it to your folder (on the suffolk.li website).
SPECIFICATIONS:
- Screen size should be 300 pixels high by 500 pixels wide,
with a light-yellow background and your name displayed in the lower-left corner.
Always begin each program with comment lines that give your name and the project identification
("test #1" in this case).
- Create a "creature" consisting of a rectangular body and an elliptical head.
Pick two different fill colors for head and body.
(Width of head or body should not exceed 100 pixels).
- Make your creature move diagonally, two pixels to the right and one pixel downward, for each frame.
- When the creature reaches edge of the screen,
make him "bounce off the wall" and continue moving in the opposite direction.
- When the mouse is over the creature, reverse the head and body colors.
- When the mouse button is pressed:
- three purple "flying saucers" (ellipses)
should surround the creature: one to the left, one to the right, and one above the head
(about 100 pixels away, in each direction).
- (These "saucers" should follow the creature
while the mouse is pressed, and disappear when the mouse is not pressed.)
- If the mouse button is pressed while the mouse is over any one of the saucers
then that individual saucer should turn black and shrink (to about half its original size).
- If the mouse button is pressed while the mouse is over the creature,
then the word "Ouch" should appear at the top of the screen,
the creatures head should get bigger (by 50% or so),
and the background should change color.
FOR EXTRA CREDIT:
- When any key on the keyboard is pressed:
- Increase the speed of the creature in the X direction,
by one pixel each time a key is pressed.
- However, if the speed exceeds 10 pixels per second,
reset it to the original value.