feyhrah.blogg.se

Death, not that harsh right?

Talking about death is never fun in real life, but is often brought up in games as a thing to make the player not wanting to lose.That will say you must create a losing condition to make it more exciting. For a game to have a losing condition you need to have something bad happen with the player character, or if it is someway else you have decided on. Anyway, in our game the losing condition will only happen if you are hit by an enemy, by it either crashing into you or shooting you, a certain amount of time, and  when that have happened you lose, or in this case "die", and will have the choice to either re-start the game or just quit it.

So if this losing condition, in any way, was to be relevant, you have to program the right code for it and attach it to the hitbox and collider. Writing the code was a simple task since what you asked for was for the object to disappear. Ad for that to happen you must program the certain collider to disappear or "to be destroyed" whenever it will be hit or collide into the protagonists object, in this case its bullet. For the "hero" or the protagonist it will either be enemy fish trying to "ram" into you or shoot it's projectiles towards you.


Since we also have enemies in the game, they most certainly do also need to have a specific way to disappear when the "hero" shoots them when it is out on it's adventure and longing for sweet revenge. So what I decided to do was using the same code and attach them the same way as I did it on the player character. Now you have the deaths for both the enemy and the player using the same method. And in our game we decided that the death of an enemy will also be added to a special high score list that will be interpreted later towards the beta.