CSE120 Sp17 Assignment - Events

Goals

Events

Step 1: Write the Starting Program

Write a Processing program that has an 800x100 drawing canvas and moves a red ball from left to right across the screen.

Step 2: Update Your Program with Variables

Declare four more integer variables at the top of your program:

Variable
Name
Initial
Value
Description
move 1 The number of pixels the ball will move on each repetition of draw() (i.e. ball speed)
rVal 255 The red ('R') value for the ball's fill
gVal 0 The green ('G') value for the ball's fill
bVal 0 The blue ('B') value for the ball's fill

Now make the changes that are detailed below. Make sure to run your code after each change to ensure that it still works correctly!

Step 3: Understanding

Open a Google Sheet and set it up to have the form shown below. Fill in the numbers for the first 10 clicks as they exist after the last assignment statement (rVal = temp;). Then explain in your own words (a short paragraph, in your spreadsheet) what is happening with these assignment statements in the mousePressed() function.

Submission