🟡 Powerup Unity Implementation Research¶
While I have been programming for about three years, C# and Unity is like a new frontier to me.
In order to properly understand and implement the powerup system as described in our concept documentation,
I took it to myself to start this sprint by doing research.
The following information in this document is what I learned and will aim to implement.
What needs to be implemented?¶
The powerup system that needs to be implemented takes heavy inspiration from the popular
SHMUP series Gradius by Konami.
It features a powerup track at the bottom of the screen with several powerups inside.
By grabbing a powerup item the track progresses to the next powerup. The player can then
decide to either grab that selected powerup or wait until enough powerup items have been obtained
in order to get the desired powerup later in the track.
Our game will also feature a powerup track. However in our game this track is progressed by nearly dodging enemy projectiles to increase the powerup track progress.
What is the problem with implementing this system?¶
The problem with implementing a system like the one above is that now that we work in Unity and C# that code works differently then I am used to. Variable types need to be given, specifiers are important and everything is a class.
I need to inform myself of the basics of working with Unity in order to get started.
How am I going to implement this system?¶
Since C# is an Object Oriented Language, the powerups need to be in some sort of class.
In order to create a playable ship on screen, we created a Player class.
However if I want to properly implement classes, instead of putting it in the Player class,
it would be better to give powerups their own.
So I will make the PowerupManager class.
This class will have a float variable called powerupValue. This variable will be used
to measure how full the powerup bar currently is and thus which powerup is currently available.
In addition to that this manager will hold a list of powerups available to the player. This list will be called powerupList.
As the player near-dodges, the powerupValue will gain x amount (0.1 for instance) to the currently stored value. If the powerupValue passes a certain threshold, a powerup will be selectable until chosen or until the powerupValue passes another threshold.
Sources¶
- Source 1: LinkedIn Unity course | Link
- Source 2: YouTube C# tips video | Link
- Source 3: YouTube C# Unity for beginners | Link