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.

This is very similar and just another way to do it. It should work but may need to be tweaked.

Global TotalSprites% = 0

Const maxsprites% = 40

IF TimeToSpawn = True and TotalSprites% < maxsprites% THEN

  IF TotalSprites% <= (maxsprites% - 5) THEN
  
    tmp% = Rnd(1,5)
    SpawnSprites(tmp%)
    TotalSprites% = TotalSprites% + tmp%

  ELSE

    tmp% = Rnd(1, maxsprites% - TotalSprites%)
    SpawnSprites(tmp%)
    TotalSprites% = TotalSprites% + tmp%

  ENDIF

ENDIF