Lesson 3 · Creative Coding
The coordinate system and motion.
The stage isn't a vague white area — it's a grid, and every point on it has an exact address made of two numbers:
The centre is x: 0, y: 0.
This is the same grid from your maths class, and the same idea as the robot grid from Chapter 2 — only now the computer tracks the position for you.
There are two completely different ways to move a sprite, and mixing them up causes a lot of confusion:
move 10 steps moves relative to where it is now — ten steps forward from wherever that is, in whatever direction it faces.go to x: 0 y: 0 moves to an absolute address — the centre, always, no matter where it was.Use relative movement for walking and gliding. Use absolute movement for resetting, spawning, and sending something back to the start.
5 more parts in this lesson
Walkthroughs, code labs, mini-games and the checkpoint quiz unlock when you buy the course.