Glossary · Phase 7 · Software engineering
Game loop
The cycle at the heart of a game: update the state, draw a frame, then wait for the next tick and do it again.
Try it now
Keys and the timer only change state. The picture is redrawn from that state every tick.
Learn it properly
Project: Pack Train, an arcade game · A grid game on the turtle canvas: game state as classes, a timer loop, key handlers and a saved best score. About 45 minutes.
Other terms from the same lesson
- event handler: A function you give a program to call when something happens, such as a key press or a timer going off.
Never trained an AI?
Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.