spawning enemies

Blitz3D Forums/Blitz3D Beginners Area/spawning enemies

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.

At the moment I'm spawning small groups of enemies randomly via Rnd(1,5) every 4 seconds and that's the way I want to keep it, but I only want 40 to spawn. Any ideas on the math? Quick and dirty example of what I mean...

Const maxsprites = 40

If TimeToSpawn = True
tmp = Rnd(1,5)
SpawnSprites(tmp)
Endif