How can I differentiate collision between 2 same objects?

0 favourites
  • 2 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hello!

    I have one hitbox object that has the variable "player", which is either 1 or 2, based on the player.

    When I now have an event like:

    On "hitbox" collision with "hitbox", how can I tell construct 2 which hitbox is the first and which one the second?

    I thought about having an event before like:

    If hitbox.player == 1 -> collision event.

    But then, how can I tell construct 2 which hitbox is meant in following events?

    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
  • If you only have two instances of hitbox, then any collision will always involve player 1 and player 2. So inside this event you can simply pick hitbox by comparing player=1 or player=2 and do what you need to do with them.

    Another option is to add hitbox into a family. Then you can use "Hitbox on collision with HitboxFamily", inside this event hitbox object will be your player #1 and HitboxFamily will be player #2. (assuming you created them in this order)

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