Score Keeping Issue
Benjamight
Member Posts: 14
This is probably an easy fix, but I'm not sure what I'm doing wrong. I have a gun that fires a bullet each time I click the mouse. I added a counter on the screen, that displays how many bullets you have fired. For some reason though, if I click the fire button while the previously fired bullet is still in the viewing area, it counts it again?
So, if I click the fire button, the counter changes from 0 to 1... but if I quickly click the fire button again (and the previous bullet is still on the screen), the score jumps from 1 to 3. If I pull the trigger while 2 bullets are still on the screen, it will jump from 3 to 6...lol. Now, I'm not the smartest person in the world, but learned basic math, and that doesn't look right...lol
A quick rundown of how I added the score... I created a "Bullet" Integer on the "Game" tab. Then, I have a "Change Attribute" command each time the mouse is clicked, to take "Bullet" and change it to "Bullet +1".
Hopefully that enough to figure out what I've done wrong.
Thanks everybody, you're always such a great source of help.
Benjamight
So, if I click the fire button, the counter changes from 0 to 1... but if I quickly click the fire button again (and the previous bullet is still on the screen), the score jumps from 1 to 3. If I pull the trigger while 2 bullets are still on the screen, it will jump from 3 to 6...lol. Now, I'm not the smartest person in the world, but learned basic math, and that doesn't look right...lol
A quick rundown of how I added the score... I created a "Bullet" Integer on the "Game" tab. Then, I have a "Change Attribute" command each time the mouse is clicked, to take "Bullet" and change it to "Bullet +1".
Hopefully that enough to figure out what I've done wrong.
Thanks everybody, you're always such a great source of help.
Benjamight
Comments
That way, when a bullet spawns, it adds one to the count. You can also optionally decrease the count right before the bullet is destroyed or off screen, or whatever.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User