I now need to add the abilities for the the player which includes:
- Primary fire
- Secondary fire (rocket)
- Smoke Screen
The first thing I will be implementing is the primary fire, once I have an initial system in place which fires bullets of trigger press I will then look into how I should limit the fire rate to balance it instead of each player continuously holding a button and firing for days.
After that I will be doing the same for the rocket and then implementing a cool down system so it cannot be used too frequently.
and finally the smoke screen which will be a similar system to the rocket apart from it will stay with and shroud the player
All three of these systems will be started with detecting a button press and instantiating the object, aspects such as speed and damage will need to be tied to the object itself so that they can each be altered as needed without affecting each other.
So after I had the initial process (asset spawn) done it was down to adding properties so it behaved as it was required to, starting out with the primary fire I had to ensure that after being instantiated it was propelled forward.
At first I thought this was working incorrectly as it looked like the bullets were firing backwards, but. After some testing it turned out that the plane was going faster than the projectiles so after bumping up their speed it was working as intended.
This then lead me onto refining it further by limiting the fire rate. at first I tried setting a low fire rate so it could still fire continuously but not so many at a time, this lead to it becoming a little slower than I wanted it to be so I continued messing with some values to try and alter the speed and the cap but It just didn’t feel right.
I then began looking into creating a burst fire system that would cut out after so many bullets were fired, and then once again started to alter values until I was happy with a result. This result was a burst fire system firing five bullets before needing to press the trigger again.
^ https://vimeo.com/user72105959/review/322822063/b62b390975
The clip linked above shows the primary fire of the plane and it has a slight delay before allowing the player to fire again.
Now it was time to start on the missile and as mentioned above this started with the same process as the primary fire by setting a spawn point and enabling spawn on button press.
and then I moved onto the properties, this required setting a force to propel the missile forward.
I initially had an issue where the capsule that I was using for a place holder would not change it’s transform so it was essentially dropping down instead of firing forward, after looking over the object and it’s code multiple times I couldn’t figure out what the problem was so I decided to delete it and try again.
This actually solved the issue and just seemed to be the object wanting to annoy me for a while. -,-
Now that it is firing correctly I needed to add a cool down so it cannot be fired continuously, I was able to achieve this by setting a last fire time variable which the system would check against a set value to wait (30 seconds).
So if the last fire time was greater than the set wait time it would then activate a bool which would allow the fire process to be repeated otherwise it will not let you fire.
One thing I was not thinking of when I created this system was that the last fire time value is counting up with the game time o it would be 30 seconds before you would acquire your first missile to fire. This was easily amended by setting last fire time to 60 on game start which would register the fire time was over the wait time and allow the rocket to instantiate and fire.
^ https://vimeo.com/user72105959/review/322822850/3404ecb548
The clip above shows the rocket firing, although the values still need to be altered as it moves little too quickly and isn’t the most noticeable at first (which is why i fired at a wall).
The final system That I had to implement onto the player was the smoke screen.
The idea of this ability is more defensive s apposed tot the other which are offensive.
The idea behind this is that when the smoke screen is active it will act as a type of shield from the AA guns, lights and battleship which would make the player undetectable for a short period of time, although that isn’t to say they can’t be hit by a stray bullet if they’re near another visible player.
This was done by activating a bool while the smoke screen is active and then going into the scripts for the lights, AA Guns and battleship and implementing a reference into each of them which would detect if said bool is active and if it is then they will activate a bool of their own essentially telling them not to see this object as a threat.
https://vimeo.com/user72105959/review/322823655/cb8251e119
The final clip shows the smoke screen being active and the player becoming undetectable by the lights and turret, placeholder effect for now so it doesn’t look the best.







