Random spawns but not on top of each other?


  • Posts: 52
Im having some difficulty more than I should creating random spawns for my actors. The problem is i dont want actor a to spawn than have another actor a or b to spawn and overlap each other. Is there a way to make a spawn and create some kind of buffer around it so I can ensure no two spawns will appear overlaping??


  • *
  • Posts: 2469
The idea is to use the scene palette actor loops to see if the randomly-generated position works and have it keep looping until it does. For example, this coding should work (if you want to understand how the position check works, look at slides 31/32 in this tutorial: http://www.stencyl.com/help/viewArticle/163)
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)