What is a game loop?
Games run a game loop: the computer updates the position of every object, checks for collisions, and redraws the screen many times per second. That makes the bird look like it is moving.
In this game, gravity constantly pulls the bird down. Each click gives the bird an upward push. Pipes move from right to left. If the bird touches a pipe or the ground, the game ends.
Try it: Flying Bird
Click Start Game, then click or press the space bar to make the bird fly. Avoid the green pipes.
Simple physics in the game
- Gravity: a force that pulls the bird down every frame.
- Lift: a sudden upward velocity when you click.
- Pipes: obstacles that move left and have a gap to fly through.
- Collision detection: the game checks if the bird touches a pipe or the ground.
Quick quiz
1. Clicking makes the bird?
2. You must avoid the?
3. Gravity pulls the bird?
Keep exploring
Try more elementary games and coding activities.
Part of the Elementary Games tutorial series.