Change your creation code for grenade to this:
(and delete the global g.grenade = new grenade line, it is not needed...)
Basically it just sets g.grenade to the last grenade of the type, and if there is no grenade in that spot, then there are no grenades on screen. Alternatively, you could just use a global number of grenades, and then incriment it when you create a gernade and decrement it when you delete a grenade, and then check to see how many grenades are present before creating.
If MouseHit(1) g.grenade = First grenade If g = Null Then g.grenade = New grenade g\x = gunendx : g\y = gunendy g\ang= ATan2(MouseX()-g\x,MouseY()-g\y) g\speed=4+me\speed g\life=100 g\ammo=1 EndIf End If
(and delete the global g.grenade = new grenade line, it is not needed...)
Basically it just sets g.grenade to the last grenade of the type, and if there is no grenade in that spot, then there are no grenades on screen. Alternatively, you could just use a global number of grenades, and then incriment it when you create a gernade and decrement it when you delete a grenade, and then check to see how many grenades are present before creating.