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#
2 ответов
+ 2
Can you show the code please?
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