Starting scripts

Let's have some fun making the cannon shoot its cannonball. It's always a good idea to script and test the interactive parts of your game as early as possible. Without scripts, it's just a bunch of pretty pictures! They might be nice to look at, but they won't keep the player entertained for long.

Engage thrusters

We have two objects to script. Object is an official programmer word that means something that performs an action in a program.

In this case the objects are visible. Our sprites are our objects. We have a cannonball and a cannon. The player will be able to control the direction of the cannon. The cannonball will fly away in a certain direction based on which way the cannon is pointing. So the way things are controlled is: ...

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.