Using a collision mask

Although our kart can move freely about the stage, it isn't in any way restricted to the road. This doesn't make for much of a game. We need a way to check where the kart is driving, and if it hits the sandbox or a wall, we should see some effect on the kart.

This means that we should start checking collision events. What do we check against? The background image describes the shape of the racetrack, but it's a single object filling the stage, so we can't check against the background by name. The kart drives on top of it, so it always hits the background.

We could check for color, but the background is a detailed image. This means that we would have to check for many different colors that would produce the same effect. It's ...

Get Scratch 2.0 Game Development HOTSHOT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.