Game Development Reference
In-Depth Information
With these variables created, we can write a script that sets up all the required values at the
start of the game.
1. We will start this script with a
when I receive <waves>
message block, because
this message triggers the game to start after changes have been made in the
previous project.
2. Next, we hide the sprite (using
hide
).
3. We also use
set size to () %
with value
40
, so it isn't too big compared to
everything else.
4. Then we use
set hitCount to ()
using value
0
.
5. We use
set speed to ()
with value 6.
6. Then we use
set turnStep to ()
with value
5
.
7. We make the sprite face left with
point in direcion ()
using value
-90
.
8. To conclude the script, we move it to its staring point with
go to x: () y: ()
,
filling in values
200
and
0
respecively.
The finished script looks like the following screenshot:
The boss sprite will remain in this staic, invisible state unil the boss event is triggered with
the boss message. So let's create the following script to trigger the boss' behavior:
1. We start with
when I receive <boss>
.
2. The next thing we do is show the boss sprite (using
show
). We already set up
everything else.
3. Then we pick an atack patern. We use a message to trigger the correct script
to do this.