I’ll kick off this series with the basic object I’ll be manipulating over the course of the exercise. It has two visible states, black or white and accepts as input the press of any button on your keyboard. The input also has only two states, pressed or not pressed, depending on whether any or none keys are being pressed.
The simplest, most straightforward interactive object we can build is this:
This is, pretty obviously, not a game. It’s a button that doesn’t even reset its state automatically. Not much to see here…
What is important though is that I will not add other functionalities to this black and white pixel through the course of this exercise. All behavior is implemented in states (like those in a finite state machine) exploiting the basic functionalities of the black/white pixel (turn black, turn white, timer, input).
Of course, you can download the executable here (swf).