How do I create coordinate exeptions?

0 favourites
  • 4 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • this is my current situation.

    i have enemies spawning randomly around the player. however sometimes the enemies spawn ontop of the player or so close to it that it is imposseble to stop. how do i prevent this from happening?

    this is my current code.




  • I think the problem is that your range includes the possibility for it to happen. Between +2000 and -2000 is your player. So, I thought that you might:

    • Could create imagepoints around the player in which the enemies would be spawned.

    • Could create a spawnable area, like a set of objects, and set them around the player in a way that they would not touch the player.

    • Set the enemy to spawn the way it is spawnning now, BUT if they are spawned near the player, they are destroyed and then spawned again until they get it right (for that you would create a box that will follow the player everywhere and if the enemy is spawned inside that box, that contains the player, the enemy is destroyed right away and then spawned again... for a better effect you should set them invisible and delay their visibility in a way that the player cannot see the enemies being destroyed by the box)

  • so i realy cant just create a hole in the spawn range. well thats a day wasted.

    thanks for awensering

    but at that point wouldnt it be easyer to create 4 diffrent spawnzones (its top down so thats why 4) and than make the time interval 4 times as large. if the spawn areas are large anouth the player wont notice that there are 4 things spawning at the same time.

    again thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sure you can do that. The last solution is the best one, but I think you would have to recode some of your stuff. For the hole in the spawn range, you could do it that way:

    I think you already thought that, but just an illustrated way to create a hole in the spawn range.

    You are welcome. =]

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