:) If only!Quote:
Originally Posted by Viza
About ten times more than was meant to. :(Quote:
Originally Posted by Viza
@tomsamson:
I'll take you up on that drink, mate. :) Haven't had anything but water for about 10 hours.
Alright, then, the attackwaves!
Each level has an XML file to store its level data. There are three main nodes: baddies, patterns, and attackwave.
The baddies node is where new baddy definitions for the level are created. It lists the width, height, health, colour, and various shooting information, as well as the path to the bitmap of the baddy.
The patterns node holds the data of how something should move. Not a bézier curve or anything, no interpolation or line equations. Just the distance that the thing needs to move on each axis every frame (one example path would be "0|1|0|2|1|0|1|1" - first frame, moving down 1 pixel, second frame, moving down two pixels, third frame, moving right one pixel, and fourth frame, moving down one pixel and right one pixel.
Obviously it'd be pretty tedious to type all that out manually. Squize made a .fla in which you'd move a box on a shape tween, and once that was done moving, it'd trace a pattern. A couple of the paths I didn't use the shape tween for - scripted their movement instead (hence the sine wave pattern I've used somewhere).
Yes, the paths are pretty long (usually about 800 characters - or more if you're using negative coordinates, since you've got a - sign as well). But it's just text, so the filesize is pretty small.
Finally, the attackwave node. This is where we specify which enemies should appear at which intervals, and what their properties are. We specify the y-trigger (as in how far through the level) of the enemy (has to be in order, learned that the hard way), the baddy type (such as exploding, regular, girder, boss, etc), the pattern number it uses, the x and y position that the baddy spawns at, and the sprite number it uses (as in which <baddies> child it is).
There was a bug which appears to be the Flash Player's fault, whereby sometimes it'd crash trying to load the XML file in the standalone player, but not in the browser (had it embedded in an HTML page). We never figured out what was up with that. :s
