Ammo No Enough!- Game Dev Series 35
Objective: Create limited ammos & ammo counts UI.
To increase the difficulty of a shooter game, there is one option is limiting the ammo.
To limit the ammo, we will need to make some changes at shooting method and UI.
First, create an integer variable as ammo and set the default counts to 15. Under the shooting check statement, decrease it by one per each shot.
Then insides the ShootLaser() method, make it can only fire if there is still have ammo.
Next is the UI part.
Create a new ammo text gameobject in Canvas.
Then create the variable and also a public method to update it.
Don’t forget to drag the ammo text gameobject into UIManager in Canvas.
Then we can call this method when we shoot. Back to Player script and add another line.
That’s it! You should get a limited ammo now!
Next: Ammo Collected!