I have been learning for more than a month now… In that time, I have learned a lot - but there is still a whole Universe ahead of me, unexplored, untouched.
I have been thinking about the whole process each day, each night. Why? Because it is fun - I like learning new things, and I have been thinking of what I can do to improve my game, improve my code, what everything I would like to learn, and so forth…
Juggling with a full-time job and other aspects of life is not easy, but it is gratifying and enriching!
It is time to mix things up in the power-up world! Right now, the player would tend to pick up any power-ups coming his way without really thinking about what they might be picking up; let’s change that!
Add a new power-up to the game - but instead of buffing the player, the player gets an active debuff for a couple of seconds.
I have decided to go with double factor debuff:
It is time to increase the challenge of the game. I will be adding more enemy types, behaviors, and the weapons they use over the next few days… But I wanted to start with something random since all games require a particular random element to make the player extra frustrated, right? - and that is giving them shields!
Randomly spawn enemies with an active shield power-up!
First up, we need to create a new Prefab GameObject as a Child to the ‘Enemy’ Prefab - this will be the ‘Enemy Shields,’ which I have decided to set the enemy…
With more and more features being added to the game, the code is starting to look a bit too chaotic. Especially the ‘Player’ script - mainly when trying to play around with the values in the ‘Inspector.
Well, it is time to do some organizing and cleaning up certain bits and pieces of the code. I will do this in four ways:
Although we created a visualization of the damage for the player some time ago, it is still a bit lacking. Sometimes the player does not even notice that he got hit, and that is where a camera shake comes into play!
Implement a “Camera Shake” system whenever the player gets damaged.
First up, I have decided that the shake will be moving both the camera and the background image - for that reason, I have created a new empty GameObject, set both objects as children, and created a new ‘CameraShake’ script.
Since, in the previous article, we have limited the player to a fixed amount of lasers that he starts with, we need to give him some way of recharging that - and that is where a new power-up comes in!
Add a new collectible power-up to the game, which will refresh the player's ammunition to the maximum. While at it, add another collectible, which will restore the player's life.
First, we need to create prefabs for each collectible - Ammo & Health.
In the previous article, we have buffed the shield power-up to hold three charges. It is only just to add some more limitations to the player. We will do that in the form of a limited ammo supply for the laser.
Allow the player to hold a maximum of 15 shots of the laser. If a player runs out of ammunition, play a sound. Update the UI to show the current & maximum ammo of the currently active weapon.
I will start by limiting the player to 15 shots of the laser weapon. For this, I will need…
We already have a shield powerup in the game… but it feels somewhat lacking right now. That’s why today, we are going to take a look at how we could buff it up a little bit!
Allow the shield to withstand three hits before collapsing. Visualize current shield strength.
First up, I have decided to visualize the current shield strength with the color of the shield itself. I have decided to go with a blue = full power, purple = damaged, red = almost depleted.
I have created an animation for each color and set each animation as…
Every gamer is familiar with some sprint & stamina mechanics. Today, I will be implementing something similar for the space shooter. A way for the player to speed up his ship for a limited amount of time, and an overheating punishment mechanic if the player uses up all of the “stamina.”
Create a limited speed boost mechanic, which, while the ‘SHIFT’ key is being pressed, speeds up the player and simultaneously will deplete the resource bar. Upon the bar depletion, lock this mechanic for a short amount of time.
To make our game a little bit more challenging, we need our enemies to have a way to damage us, other than the player ramming into them. And that is where, naturally, more lasers come in!
First up, I have changed the color of the enemy laser Sprite to green using Photoshop. Next, I have created an empty object called ‘Enemy_Laser’ where I have put two laser prefabs, adjusted their transform, and saved it as a prefab.