4.1

Part 1–

Read Learning Processing 15.1-15.2, 16.1 – 16.3

Part 2–

Continue to work on the sketch we started in class today (Go back to the bouncing shape example from last week. When the user clicks on the shape, stop moving the shape. Have it start moving when the shape is clicked again). Note- it’s easier to use a rectangle than an ellipse.

**HINT** To “freeze” motion, simply set x = x; (this is like saying don’t update x with anything, just keep it exactly as it is). Then you have an else statement that says “if the freeze button is false, update the x location”.

if(freezeButton){
x = x;
}
else{
x = x + speed;
}

Here’s an example of what I mean by that. Note- this sketch does not check to see if you are clicking on the moving object. That’s your part to figure out!

Once you have that working, add at least 3 more moving shapes. Have one change its color when it’s been clicked on, have another change direction, and have a third change shape when it’s clicked on. 

When the user clicks anywhere in the background, change the background color to one of three different, pre-determined colors using the “state” concept we discussed in class today. Make sure you cycle state back to 0 once the max number of states has been reached.

Upload your sketch to the class blog before Midnight on Wednesday, February 21.

Print this page

Leave a Reply

Your email address will not be published. Required fields are marked *