🎮Game Loop
Also known as Main Loop, Update Loop, Game Tick
A loop that reads keys, moves things and draws the screen, over and over.
Think of it like
Think of it like a flip book. Each page moves a little, and flipping fast makes it move.
Example
In Jack's game, each pass of the loop checks the arrow keys, moves the car and draws the road again.
Why it matters
Everything in a game happens inside it. Knowing it explains why slow code makes a game stutter.
Definition
Example code
python
while running:
read_input()
update(dt)
draw()Common mistake
Key takeaways
- 1Input, update, draw. Each pass does the same three steps.
- 2Many times a second. Often about 60 passes each second.
- 3Keep it quick. A slow pass makes the game stutter.