How do I random position spawn after kill outside play area

0 favourites
  • 3 posts
From the Asset Store
A complete set of Graphic, User Interface element to build 2D mobile game or PC game.
  • Title is not very clear. I want an enemy to spawn only outside the playable area after another instance of that enemy has been destroyed. What is the X Y spawning coordinates needed to ensure the enemy does not spawn in the playable area? (this is for a turret survival game)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In your spawning condition you can use "not inside layout" condition to allow a valid spawn. It will then keep trying to place until it was outside layout. I have used this method on several projects and even with quite a few spawning objects its pretty fast with little overhead.

    Otherwise you will have to determine the x,y values for your screen size and manually spawn outside these values.

    You could cheat a little as well.. you could place "spawner" sprites outside your screen area and then randomly choose one of them to spawn from. I use this method when I want the enemy to randomly come from off screen but control their entry more precisely..

  • Thank you. Got it sorted.

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