Make something move
Coding & Game Development
Work at your pace. Take a break between stages; there is no countdown.
You need: paper, a pencil and this lab. A helper is welcome for reading and discussion.Connect to what you know
Your drawing program followed a sequence. A game must also know WHEN to act.
Understand it, step by step
- 1
An event is something a program can respond to: starting, pressing a key or clicking a button.
- 2
The event handler is the list of actions attached to that event. Our player starts at square 0. A move action adds one to its position.
- 3
A start event happens once. A button event can happen many times. Pressing a button does nothing if no handler is connected to it.
Connect “Right button” → “move 1”. One press moves 0 → 1. A second press moves 1 → 2. Connecting “Start” instead moves once when Run is pressed.
Pause and predict
Will three Right presses move the player if the handler listens only for Start?