I'm face trouble in a shooting 2D game i want to set limits of a gun that is it can fire 5 bullets but and it goes to 5,4 to -1, | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

I'm face trouble in a shooting 2D game i want to set limits of a gun that is it can fire 5 bullets but and it goes to 5,4 to -1,

I want to set limits on Gun's bullets that is 5 but it decreases to negative points that becomes unlimited. ..in c#

27th Jan 2019, 4:24 PM
unknown gamer
unknown gamer - avatar
2 Réponses
+ 2
Can you show the code please?
27th Jan 2019, 6:00 PM
PhantomWare
PhantomWare  - avatar
0
int ammo = 5; bool hasAmmo => (ammo > 0) void pew() { if(!hasAmmo) //if no more ammunition return; //code ammo--; } or you could only decrease if its above 0
29th Jan 2019, 8:26 AM
Ovisionik A.G.
Ovisionik A.G. - avatar