Simple animations: moving a sprite

Computer Science · Key Stage 2 · The School

A sprite is a moving character

A SPRITE is a picture on screen that a program can move. Blocks like "move 10 steps" and "turn 15 degrees" tell it what to do. Put several blocks together and the sprite performs a short animation. A cat, a car, or a character you drew yourself can all be sprites. A whole scene can hold many sprites at once, each moved by its own set of blocks. None of them needs to know what any of the others are doing.

Changing costume

Most sprites can swap between several COSTUMES, which are just different pictures of the same character. Switching costume quickly, over and over, makes a sprite look like it is walking or flapping its wings. Two costumes swapped ten times a second can look like real, smooth movement. Cartoons and old flip-books use exactly the same trick.

Order matters

Blocks run from top to bottom. "Move 10 steps" then "turn 90 degrees" gives a very different path from "turn 90 degrees" then "move 10 steps". Swapping the order of two blocks can completely change what the sprite does, even though the same two blocks were used.

Debugging a sprite that goes the wrong way

A sprite is meant to move right but drifts downward instead. Check the blocks in order. A "point in direction 90" block near the start would explain it — 90 in most programs means facing down, not right. Fixing the direction number fixes the whole animation. The blocks after it were never wrong at all.

The School — all subjects · Knowledge map