Mousedown executes code twice

BlitzMax Forums/BlitzMax Beginners Area/Mousedown executes code twice

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

And the dumbass of year award goes to:
ME!

I had "accidenally" created two instances of the player object, hence two lightning bolts and two explosions.

See, there's a damn good reason this was posted in the n00b forums ;) Works fine now.

Indeed there are many ways to limit the number of shots. I currently use a "cooldown timer" I explained earlier which works fine, formatted properly:

...
If ( shot_counter < 10 ) shot_counter:+1
If MouseDown(1) fire_lightning()
...

Method fire_lightning()
  If ( shot_counter = 10 )
    shot_counter = 0
    make_lightning_bolt( x, y )
    make_explosion( x, y )
  End If
End Method


Thanks for the helpful replies, guys.