This site requires JavaScript, please enable it in your browser!
Greenfoot back
KimoDev
KimoDev wrote ...

2017/5/25

Loop enemy spawning

KimoDev KimoDev

2017/5/25

#
Can someone tell me how to loop the spawning of my enemies. for example, i want a meteorite enemy to randomly keep spawning while my score is less than 100. anyone help me pls? every time i try, multiple meteorites only spawn once and move down along the same x axis
Super_Hippo Super_Hippo

2017/5/25

#
Show what you have tried (use code tags). Hints: - You will need two conditions to spawn a new meteorite, one is the score and the other one has to be a timer or a comparison with a random number so you are not spawning one each act cycle. - Place the code into the act method of the active world.
danpost danpost

2017/5/25

#
The loop is what is causing multiples to be spawned at once. Use an if statement with a random chance to spawn.
You need to login to post a reply.