O'Reilly logo

Scratch 2.0 Game Development HOTSHOT by Sergio van Pul, Jessica Chiang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dealing with collision events

Now that we have a collision mask, we can have our kart respond differently, depending on where it is driving. When on the road, the kart will increase throttle up to full speed. When hitting the sandbox it will be slowed down, and hitting the walls is even worse. The kart will bounce back and completely lose momentum.

Let's build these responses with a few scripts.

Engage thrusters

We will add a series of script instructions to the player1 sprite. We will assemble the instructions first, then place the script segment at the right spot in the existing script:

  1. Start with an if () then block.
  2. For the condition, we will check touching color ()?.
  3. Click on the color box and then on the sandy color of your collision mask with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required