03.26.07
Asteroids Updates
Been a while since I last updated on this, and I’ve added a lot since my last post, so lets see now..
I’ve got my relatively simple health system in place, whereby a hit from a small asteroid will only change the ship’s state to damaged, rather than destroy it instantly, and it’ll two small ones to lose a life, whereas you lose one instantly when pelted by a big one. Was a bit complex, and some bugs occured that needed fixing, but now it works very well. Frame 5 is the damaged frame, in the ship’s movieclip, and it features some explosions and smoke etc. In the collision with the small asteroid, it simply determines whether the current frame the ship is on is and moves it to 5 if on 1 (after a temporary invincibility animation), then jumps to the dying and regenerating animation if it’s already on frame 5. For both asteroids, if the ship is at a frame other than 1 or 5, it will not affect it, and the asteroid will only explode if it’s shot or causes any damage at all, and only gives you points if you shoot it.
I found an annoying bug where if the ship happens to occupy the same space as an asteroid when it comes out of its temporary invincibility and into frame 1 or 5, it’ll get stuck on the first frame of its exploding animation and will therefore be stuck in an invincible form. Emerging from hyperspace also caused this problem, and it also stopped me from begining the game in temporary invincibility to protect the player from dying straight away. This was eventually solved by sticking a “play();” in the frame actionscript, which it should have been doing anyway, but wasn’t for some reason.
Had a bit of a problem with my arrays as well, specifically removing the asteroids from the array, using the splice method. I could eventually get it to do it correctly in the bullet class, but I also needed to remove them when they collided with the ship too, which wasn’t using a do loop to run through all the known asteroid names. It was all a bit fiddly, and I couldn’t do it, so in the end I just used additional variables to count the number of large and small asteroids, altering on creation of new ones and their removal. This allowed the game to finish when the number of both reached zero.
As an additional feature, I fairly easily implemented a fuel system, where a fuel variable, begining at a value of 1000, declines based on the speed of the ship, divided by a particular amount on every frame. So the faster you move around the area, the faster your fuel is depleted, and when it reaches zero, the moveForward function for playership is disabled, so you lose your ability to travel. Using setInterval, I also created a timer that begins at 99, and counts down the seconds, until you run out of time and the game will be over. It’s actually difficult to make the game last that long, so I think I’ll reduce that amount. It’s all in aid of creatinga more complex scoring system though, as the higher your timer and fuel amounts are at the end of the game, the more bonus points you’ll get, and I want to make sure there are plenty of elements in creating a score that can always be improved upon.
Next, I’m on the xml scoreboard, and it’s proving confusing to say the least. Then, I have the preloader to take care of, and still need to make my stars actually. Then it’s on to more extra stuff, including my final score tally, and powerups!