How do I Give priority in an overlapping?

0 favourites
  • 4 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hello,

    I making a beat ' em up, and the hero can hold an enemy if a little sprite square, linked to the hero, overlapping with the square of the enemy.

    I don't want the hero can hold two enemies in the same time, but, sometime, they're overlapping togheter ( beacause they entering in overlap in the same time ).

    How can I give them the priority?

    I tried to say to the software to take the closest in the coordinate X and Y, but probably something is wrong....

    Thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • mirko26

    Just add a global variable or instance variable IsHolding set to 0, then

    Sprite: On collision with Enemy AND IsHolding is = 0 => set IsHolding to 1, pin Enemy to Sprite (or whatever function you have in place.)

    (When you are ready to throw, drop or whatever your Enemy:)

    If key is down => set IsHolding to 0

    That way, it will only act on 1 Enemy at the time.

  • mirko26

    My bad, what I meant to say is:

    Enemy: On collision (or is overlapping if you are using a mouse or keyboard input to trigger the event) with Sprite And IsHolding

    sub-event Enemy: pick top instance => ....

  • Yesss sure! Thx!!!

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