Game Development Reference
In-Depth Information
Adding a test script
Before we dive into the excitement of creaing the boss enemy, let's irst do something
smart and create a script that helps us to test the boss that we create.
Prepare for lift off
As you may have noiced while tesing the game, waiing 90 seconds for the boss to
appear is a rather long ime. We could just decrease the wait ime in the script, but that
has a few drawbacks.
It would be more diicult to test the wave phase of the game, since the imer runs for
such a short ime.
We run the risk of forgeing to change the imer before inally publishing the game.
A beter opion is to create a separate
temporary script
that we can throw away when
we have finished the game without any risk to all our hard work.
Engage thrusters
We will add this script to the
Stage
sprite. This is often the best place for these kinds of
control scripts.
When a certain buton is pressed, we will change the ordinary low of things, as follows:
1. Start a new script with a
when <b> key pressed
block. We can use any available
key. In this case, "b" stands for "boss", as a handy reminder about what we are
trying to do.
2. We set the three score values (using
set () to ()
). This is similar to the
when
<green lag> clicked
script next to it.
3. Instead of supplying a fixed number, we will use
pick a random number between ()
and ()
and fill in the values
1
and
30
respecively. This way, we fake having scored
some points during the game, so we can see the effects of the upgraded spear on
the boss.
4.
Then we use
broadcast <boss>
to start the boss phase immediately.