Powerups, powerups & powerups!

So this week is the last sprint before the beta, and therefore there’s a huge amount of work that needs to be done. I chose to finish all of the remaining powerups that our team have yet to scrap. These are the shield upgrade, rocket launcher and laser cannon. All of them was supposed to have different mechanics and behaviors which is the more difficult part to actually succeed in.

First upgrade i decided to try and create was the one i deemed the most difficult of the lot, the shield. Essentially what I had to do was to rework or previous healing function so that instead of healing, it blocked damage until it was depleted and after that the damage started to drain the players hp instead.

I started with creating a sprite with a bounding box and put that sprite in a certain spot. I then made it so that if the player drove over the sprite a value would change from 0 to 1 showing that the shield would be active. I then went and added an if statement where the player takes damage that roughly asked if the shield is active, attack the shield until it’s depleted. If the shield is depleted, attack the players regular hp.

Note that depleted =//= inactive since the shield is only inactive before you’ve picked up the upgrade. After that you have the shield permanently. Depleted is a state that means that it’s still active, but does nothing until it’s charged up.

Next up on the chopping block is the implementation of different kinds of weapons. In our current state of the game we only have a main cannon that shot bright yellow projectiles. So I had to manage to implement a rocket launcher that shoots bigger slow moving projectiles that explode when they hit a bounding box and damage in a small area. I also had to implement the laser cannon which shoots bright red projectiles that pierce boundingboxes resulting in the player being able to hit several enemies with once shot.

All I did was to re-use our previous projectile code and rename all the variables and change some numbers, implement them into the other classes with pointers and then add new sprites and animations. However I havn’t managed to get the rocket launcher to explode in a small area. I do however know how am supposed to tackle this particular element. I just have to spawn in a bounding box on the position where the projectile hit and that any other bounding boxes that are inside or touching the spawned in one takes damaged.

81494c8a1eb0b22149a26a0cd5e89a88

About Alfons Warg

2015 Programming