• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows Instance number incrementation

M

Midastouch

Guest
Hello everyone,

I have a gun that can shoot bullets.
If my bullet touch a wall then this bullet is destroyed.
I want to know how many bullets have been shooted (bullet "alive" + destroyed).
Is that possible?
 

Alexx

Member
Several ways of doing this.
If you want as you have asked:
Count the number of bullets on screen.
Make a variable that counts destroyed bullets.
Add them together.

If you just need a count of bullets fired, just increment a variable each time a bullet is fired.
 

Alexx

Member
Set up a 2d array.
You can then store all your gun data in this, such as:
Weapon name, weapon sprite, clip size, current ammo, ammo shots, hit rate, etc...

I have a guide to arrays if you would like it.
 
Top