Hello, I have a problem with spawning monsters in my game, I want to spawn monsters with delays (in waves) when I code it Like this:
Sync On
Sync Rate 60
Backdrop On
spawnwait as float : spawnwait = 1000
spawn as float : spawn = 0
Do
SpawnMonster()
Sync
Loop
function SpawnMonster()
If spawn = 0
dec spawnwait, 1
EndIf
If spawnwait < 1
spawn = 1
spawnwait = 1000
EndIf
If spawn = 1
Load Object "monster.x", 1
position object 1, 0, 0, 0
EndIf
endfunction
I want to use this function one time only if spawn = 1 for first sync, not when it is one for third, fourth (then I have error object alredy exist at line ...)
the leader of Mouseking studio