ICM Help Session Week 4: Functions
Craig
This week’s help session focused entirely on functions – What are they? How do we use them? And how can we write our own?
Here’s a link to all the CODE.
Arrow Sketch
- arrow_01 - draw an arrow with hardcoded values
- arrow_02 - substitue the hardcoded values with variables
- arrow_03 - create new functions outside of the draw loop to draw and move the arrow, use a void function (no return value) and an int function (returns an integer value) to execute this
- arrow_04 - add a second arrow into the draw loop
Snowman Sketch
- snowman_functions – create a function to draw a snowman, draw 100 snowmen in a 10 x 10 grid, move the snowmen
Thursday’s ICM Help Session | CODE
We went over objects, passing data into an object’s functions from the draw() loop and even functions that return data so that one object can communicate with another object.
We made this very avant-garde sketch of two balls where one ball stops and goes whenever the other ball bounces off the top or bottom.