How do I Stop Enemies Spawning Near Me

0 favourites
  • 2 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 45 enemy ship sprites to be used in your game.
  • Hi,

    I am 14 years old and creating a game for my school assignment. My game is about Crocodile Dundee and you need to run around killing crocodiles and gaining points. I have one problem though, since my enemies are set to spawn at a random X axis (but a fixed Y axis) this means they spawn anywhere, even under me, making this game nearly unplayable.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Check if the enemy.x is within range (say 50 pixels, or width of player, etc.) of player.x, and do another random respawn if it is

    e.g. if abs( player.x - enemy.x) < 50 -> try another spawn

    Or just check if the sprites are overlapping, and do another random respawn if they are (keep the enemy invisible until then).

    There are other ways too, like not spawning on the player's location in the first place..

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