Frames and motion: movement is many tiny steps
Nothing in a game really glides. It moves in tiny steps, a little each frame. It happens so fast that your eyes see smooth motion, just like a flip-book.
The big idea
Motion is many small position changes, one per frame, that add up to smooth movement.
See it in code
Motion is really just a spot changing by a little, again and again. Watch y grow by 10 five times:
y = 0
for step in range(5):
y = y + 10
print("y is now", y)y is now 10 y is now 20 y is now 30 y is now 40 y is now 50
No big jumps — just +10, over and over. Stack up enough small steps and you get movement.
Now a real enemy. We draw it once at the top, take 200 tiny move_down steps, then draw it again — so you can see where it started and where it ended up:
from game import Stage, Enemy
screen = Stage.create()
Stage.clear(screen)
enemy = Enemy(240, 90)
enemy.draw(screen)
for tiny_step in range(200):
enemy.move_down()
enemy.draw(screen)
Same enemy, two moments. All those tiny steps between them are the motion. A game just shows one step at a time, very fast.
Add more moments and the path fills in. Here we draw the same enemy at five points in its fall, nudging it with move_down between each — and the snapshots trace the whole path:
from game import Stage, Enemy
screen = Stage.create()
Stage.clear(screen)
enemy = Enemy(240, 90)
for snapshot in range(5):
enemy.draw(screen)
for tiny_step in range(70):
enemy.move_down()
Each enemy in the trail is the same enemy, drawn after many tiny move_down steps. In a real game you only see the newest one each frame. But the motion is always built from small steps like these.
All animation works this way — cartoons, games, movies. It's lots of small changes, shown fast. Bigger steps mean faster motion. Smaller steps mean slower, smoother motion. Speed is just how big each step is.
Try it yourself
Change the inner range(70) to range(35) for smaller steps, and the snapshots bunch closer together. Then make the enemy drift sideways too by nudging its x a little each step.
The common mistake
Making each step too big. If you move an enemy 200 pixels at once, it seems to teleport instead of glide. Small steps, repeated fast, are what make motion look smooth.
What it unlocks
Motion happens inside the game loop, moves sprites, and builds sliding enemy waves.