Game Development Reference
In-Depth Information
Objective complete - mini debriefing
The clone script will cause the clones to face the mouse cursor. Then, they will start moving
for a limited number of steps before being destroyed. This will cause the cannons to have
a limited range. If you would like a longer or shorter range, you can change the default
numbers. The repeat number determines how long the cannonball will be on the stage.
The move number will determine how fast the cannonball moves. Keep in mind that very
fast moving cannonballs might skip over enemy posiions and therefore miss, even though
it will look like the cannonball moves straight through them.
Classified intel
It's generally a good idea to collect all the iniializaion scripts that aren't ied to a speciic
object in the Stage object. That way you will always know where to find these variables and
you don't have to search through many objects and scripts. You will see that in many cases,
this is used to reset the global variables such as lives, points, power-ups, and in this case,
object coordinates.
Learning about list variables
Lists are a type of variable that can contain more than one value. I compared a variable to a
jar containing one thing. You can compare a list to a shopping list. The list can contain things
that belong together, like all of the groceries we want to get from the shop. Not only do we
want to get pickles but we also need bread, buter, cheese, tomatoes, and so on. Those all
go on the list. When we get an item, we can strike it from the list; thus, deleing it. Oh, we
also need onions. We can add that to the list. You can add and remove things from lists as
required. You can even add things in between other things by wriing between the lines. But
in the case of a computer, all the things that follow will just move down a bit to make room
for the things that were added.
Learning about global and local variables
There are two types of variables. They work essenially in the same way, but their scope
is different. Scope is a word that means how far their influence reaches. You have global
variables that can be seen and used by all objects in a project. In Scratch, you can set this
with the For all Sprites opion, which is the default. You can change this opion to For this
sprite only to change the variable to local. That means this variable is only known to the
sprite that it was created for. You can't use this variable in other sprites. This can be useful if
you have similar variables that need to have a different value for each object, like a personal
speed value for each enemy we use in this project.
 
Search WWH ::




Custom Search