Thursday, April 03, 2008

c-c-c-changes

An update to the progress of Orbs is well overdue.

orbs_grab3.jpg

Some big changes. I've re-done the collision routines. They were a simple brute force method ( Checking bullet 1 against each baddie, checking bullet 2 against each... ), now they're based on a grid system. I've done simple sectors before in my old asteroids clone, X, but that was just splitting the screen into quarters, this uses smaller sectors ( So it's more of a grid than just sectors. Moot point I know ).

I've also altered how the particles were plotted. I always wanted to use the Add blendMode as it looks so good ( The Orb itself is a sprite and uses that blendMode ) but the particles are blitted into a bitMap using copyPixels for speed.
I bit the bullet and changed it to use Draw(). Slower ( As it uses Flash's vector renderer ), but I think the visual pay off is worth it. I'm panting to code the smart bomb as it should look great a whole screen full of baddies blowing up in go, with the blendMode it should nearly white up the screen.

With the collisions, I've had to code a bounce routine for the orb, so when a baddie hits it, it moves. Added to that the player bullets now hit the orb and bounce off realistically too ( As opposed to a pong still rebound where the direction just changes ).
In doing this I was badly anal and coded up a faster version of atan2, just to save a handfull of ms
I'm really pleased with how it feels, you can shoot the orb and push it into a baddie to kill the baddie. It feels great being able to move it around the screen by shooting it.

The title screen is in place, and I used papervision for the background. Having never used it before, I was blown away! Really straight forward, and stupidly fast. I now totally believe the hype.
As part of the title screen stuff I've started on the stats page, and got some medals in there ( Achievements with a different name ).

orbs_grab4.jpg

Going back to the collisions, I knew the player > orb collisions were going to be a bit of a mare. I was toying with using Box2D for them, but realised that was overkill for this game.
The solution ? Give the player a shield ( As seen above ) and then it's just a simple circle-circle collision check. Much quicker and much easier. With the Orb already being able to rebound it was just a case of making the player ship do the same. So now you can push the orb around the screen as well as shoot it around.

The shield also sorts the problem of a baddie teleporting on top of you. If that happens, the shield will just kick in, and the baddie dies. Two birds with one stone, great.

There have been quite a few more updates, but time talking about them is time not adding new stuff. I'm hoping to post an alpha here in the next 2 weeks, just to get some nice early feedback.

Squize.

#    Comments [7] |