Time for a quick catch up on DN8. It's been a bit of a slow week hence the lack of updates, but it's finally starting to take shape.
Since last time we've got a player sprite in there, which just follows the mouse on the horizontal, nice simple stuff. I added in some player bullets which really didn't take much time ( Although I feel there's going to be some re-factoring when it comes to the power-ups ), and fresh off the press are the baddies. At last.
Normally for baddie waves I take an ultra simple approach. Open a fla, draw a nice curve, turn it into a guide, tween a sprite along that guide and spit out the coords as an array, drop that into the game and its job done.
I started doing it this way again for DN8, but for the life of me I couldn't get it to follow the guide properly. After about 5 minutes of swearing at Flash ( Not my fault obviously ) I decided that we're going to have mathematically created waves. Yes, my lack of patience has created a ton more work.
At present the game only handles Bézier curves, but they sure do look pretty. To create a pattern I just do the following:
That's for the actual wave ( Curve ), and then we just
triggerTime being when we want the wave to run, waveReference being the first array with the curve parameters in, baddieType just because, NumberOfBaddies is so we only have to calculate one curve and have as many baddies as we want following it, and GapBetweenEachBaddie being a delay in frames before triggering the next baddie ( So say we have 10 baddies, to stop them all appearing at once we can set GapBetweenEachBaddie to frameRate*2 to leave a two second pause between each coming in ).
There is a bit more in there which is possible due to using curves like this, but I don't want to splurge it all into your face in one go, we need a bit of mystery in our relationship don't we.