Lesson 3 · Creative Coding
Bring a character to life.
Animation looks like magic and is embarrassingly simple:
Change something slightly. Wait. Repeat.
That's it. A character walks because its costume swaps between two poses, over and over. Something floats because it moves up two steps, then down two steps, forever.
Every animation you've ever seen — film, games, cartoons — is this same trick at speed.
A sprite can have several costumes — different pictures of the same character.
Swap between them inside a loop and the character appears to move:
forever
next costume
wait 0.2 seconds
The wait is essential. Without it the costumes change hundreds of times a second and you see a blur. The speed of an animation is decided by that wait value — and tuning it is the difference between a walk and a sprint.
5 more parts in this lesson
Walkthroughs, code labs, mini-games and the checkpoint quiz unlock when you buy the course.