How do I set random spawn points

  • Hi, I;m making an arcade style endless game and I was trying to figure out how to spawn monsters at set times at a random set point just outside of the game layout.

    Currently I have

    Event = [System] Every 8 seconds

    Action = [System] Create object (ENEMY) x = choose(-40, 690) y = choose(50, 100, 150... etc)

    My problem is I want them to spawn around the top and bottom of the game too but I'm having trouble figuring out how to set those points. because if i add the top x points and the y level what if it chooses to mix the coordinates and spawns in the middle of the level. The only way around this I can think of is to create another event and then stagger the times to take turns or to somehow randomly choose an event. but I dont know if either of these are possible or there is an easier way or even how to do my ideas.

    Thanks all feedback is appreciated :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can put an invisible sprite at the points where you want to spawn your monsters. Then select a random instance of this sprite and spawn.

    I made a demo some time ago with different spawning methods:

    dropbox.com/s/0jptlam49u7ugse/spawningDemo.capx

  • Thank you so much! :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)