2.2

REMINDER- THERE IS NO CLASS SCHEDULED ON TUESDAY, 2/12. Happy Birthday Lincoln!

DUE AT MIDNIGHT THE NIGHT BEFORE NEXT CLASS (11:59PM on Wednesday 2/13)

Part 1-

Write the following variable declaration and initialization in code. Copy and paste the code to your blog post.

1. Declare int variables named r, g, and b and assign them with a value of 255
2. Declare a boolean named sunny and assign the value false
3. Declare a float named x, assign it the value 12.0
4. Declare a float named z (no assignment)
5. Assign the z variable the value of previously declared x plus 25
6. Declare a variable named y, assign it the value of z plus x

 

Part 2-

Continue to work on your sketch from Tuesday (or feel free to start a new one). Add the following:

  • Re-write your code so that any number you use more than twice is replaced by a variable
  • Vary your variables to create an animated sketch
  • Include at least one random number
  • Use mouseX and/or mouseY to move something in your animation
  • Include keyPressed, mousePressed, and/or mouseDragged

My example:
Part 3

Read ahead for next week’s class, Learning Processing, Chapter 5. If you’re feeling ambitious, try to incorporate an IF statement into your code (my example above has an IF statement for when the user clicks the mouse)

 

 

Leave a Reply

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