First, there are several command macros at
the top of the file. These define the actual script commands and
should be used rather than raw DB commands.
There is a list of these commands and what the do in the appendix. At the start of the main file there are several control words, these must come before any actual script commands. This points to the path an explosion will follow and is the default explosion used when there are no death paths (like coins or pickups). dw BoomPath Now comes the main script. The script system is in fact a
multi-threaded system. It allows for up to
MaxPaths (10)
threads at once. This allows for 1
MasterPath
and 9 baddies. The master path is invisible and controls the whole
flow of the level. It starts sprites, waits for level points and
controls everything. Example: create a very simple chain of sprites for the user to shoot. First we set the BoomPath (death explosion): dw BoomPath We then wait for the 4th character to scroll on. This is like doing a Pause 4*4:
StartPath: After the level has started scrolling, and we’ve
waited for a bit, we now want to bring on some baddies. We do this
by starting a new sprite just off screen. We use Hires cords for the
sprite but the system will only display the sprite on MCM
coordinates. Start DemoPath1, Baddie1, 330, 70, KillClip This will start alien Baddie1 at 330,70
and sets the flag
KillClip on this alien. The flag
KillClip means that once the alien is on screen, it will be
automatically killed off (freed) when it leaves the screen. This
avoids us having to keep to close a watch on the alien, and allows
us to go fairly complex paths and worrying about the sprite slot
being hogged.
Pause 10 Now this will wait for 10 game cycles and then
start another sprite off at the same location as the last. Of course
The first sprite will have moved from there and progressed on
through the DemoPath1. What this makes is a chain of sprites, one
following after another. Adding more of these would create a larger
chain of sprites (up to 9).
dw BoomPath Now that we’ve managed to start 6 sprite, we need a script for each of them to follow. Lets start with a simple one, we’ll use LOOP’s to pack it down a bit better.
DemoPath1: As you can see from this very simple path, the
sprites move into the screen, move down, and then move back off the
screen. Kind of like a U on its side. We could remove the loops and
add lots of
Move commands, but that’s just a waste of space.
DemoPath1: This would move the sprite to the left until it
had moved off the left hand edge of the screen. The script system
would then kill the sprite itself and free up the thread.
BoomPath: Drift
0
;
cancel any drift This is a simple delay really. It clears any Drift (used in commands like Circle) and then sets the animation to the explosion. It then just waits for the animation to finish, and kills the sprite when it’s done. |
See also: |