Week 2: User input and conditions

This week we introduced students to the concept of "user input". This allows us to write programs with which they and other people can actually interact, and is a vital early stepping stone in our curriculum.

After a quick refresh of our existing programming tools (ellipse, rect, fill), we started into the three main topics of week two.

  1. User input: This is a big subject so we started off with mouse button clicks. Once students had this part figured out we moved on to distinguishing between left and right button clicks, and using each one to do different things.
  2. If conditions: 'if' statements core to all programming logic. They allow the programmer to test if a 'condition' is true or false, and act in different ways depending on which it is. 
  3. We also introduced the "pointer base", a simple programming tool (programmed in-house by the Academy of Code team) that helps show the position of the mouse on the app window, allowing easier identification and placement of shapes on-screen. Most students find this useful, but especially those who might be struggling slightly with the co-ordinate system, or those younger students who simply hadn't come across it before attending the Academy of Code.
Eammon and the Tuesday class coding up Pumpkins

Eammon and the Tuesday class coding up Pumpkins

Other things we learnt:

Another basic function, background - similar to the fill command (and similarly allows students apply their knowledge of RGB colours from week 1!), this function lets us set the colour of the background of the window.

We also took the opportunity to get seasonal (if perhaps several weeks early), and students practiced their use of functions and co-ordinates by drawing pumpkins and ghosts!