Here are a few tips:
side each other. While this is legal, it
probably won’t do what you want.
• For this exercise, use the Change X
By and Change Y By commands.
These are very powerful and will allow you to have complete control of
sensors and changes.
sprite also go up and down.
Game developers have two major types
of motion. Sometimes (as in the last example) you directly control the X and Y
position of a sprite. Other times, it’s better to think about motion as speed and
direction. Scratch makes it pretty easy to
use this method as well. As an example,
look at the following airplane game:
In this game, you control an airplane.
The Up arrow moves you forward, Down
moves you backwards, and the Left and
Right arrows turn the aircraft. (I know
airplanes don’t move backwards, but this
is my game, and I’ll make up my own reality, thank you very much.)
For the most part, this game is much
like the other motion. Just think through
how you will change the movement.
Oh, No! It’s a UFO!
The airplane example is cool, but it’s not
really a game yet, because we don’t have
anything to smack into. What kind of
self-respecting game doesn’t have some
sort of mayhem? Take a look at the next
example to see some fun: www.aharris
way to clean up your behaviors; consider using it.
We’ve Got All the Time
in the World
In every game, there has to be some sort of
goal and some sort of obstacle. The goal of
the airplane game could be running into
the UFOs, but what’s the obstacle? Time
is one of the easiest obstacles to manage.
The next goal is to make a timer. Here’s an
example in Figure 5: www.aharrisbooks
The timer is pretty easy to use. It’s always
been there, but you might not have seen it
before. Look in the Sensing tab. There’s a
button called Timer with a little check box
next to it. Click the check box, and you’ll
see the current number of seconds since
the timer began. That’s not a helpful thing
by itself, but you also have a Reset Timer
button. Think about how you can be sure
the timer resets at the beginning of a game.
(Remember, the game always starts right
after you click on the green flag.)
Something needs to happen when the
timer is finished. What you’ll need is another condition. If you want the game
to stop after 10 seconds, you’ll need to
compare the timer to the value 10. Look
in the Operators tab and you’ll see the >
(greater than) operator from math class.
See if you can figure out how to make a
condition that triggers when the timer is
greater than 10. You will probably want
the game to be longer in real life, but it’s
much easier to test the game with a short
time span at first. You can make it longer
once you know it’s working right.
There are a number of things you
could do when the timer reaches 10, but