How can I check positions to not overlaping?

0 favourites
  • 3 posts
  • Hello Everyone,

    I'm making a shooting 2D game like Wild Guns (SNES)

    If you don't know the game:

    I have a character, and I have defined 6 possible positions where the enemies can appear.

    So, when the player touch an enemy, this is destroyed, and I create a new object of the type enemy.

    The problem I'm facing is that the enemies can appear in the same position (overlaping).

    What I want to do (and I can't figure) is how can I detect if a position is used, and if it is then spawn in other position to avoid the overlaping.

    Sorry if you don't understand me, sounds a little complicate.

    Here is my capx if you want to see by yourself the issue:

    Thanks in advance.

  • Hey Dakiu.

    Sorry I dont have the function plugin so I cant look directly. But did you know that if you right click on most events, you get the option to "invert" them (make it the opposite rule).

    So if you had a marker where you were spawning enemies, you could invert "Enemy is Overlapping Marker" - which would of course mean whenever the enemy 'isnt' overlapping the marker -> spawn another.

    Another idea is to have them spawning after a set periods of time. Maybe once every 10 seconds?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello GenkiGenga,

    I forgot to mention that I'm using Rex's function plugin.

    Right now, I have the positions with coordinates, but your solution to use sprite and check the overlaping looks good.

    I'll try to use it.

    About the second option, is not useful because I want to have like 3 or 5 enemies at the same time :( and when one dies, instantly appears other

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