Pushing overlapping objects away from each other

0 favourites
  • 4 posts
From the Asset Store
I-Spy (Hidden objects)
$34.30 USD
30% off
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hey all, I got Construct 2 a week ago when it was on sale and I'm really digging it, it's very intuitive. However, I'm a bit stuck.

    I have this enemy (Platform type) that I've made to chase the player along the ground. The probably is that they always end up overlapping each other and forming this bothersome singular mass.

    Is there a way via the events to push them apart? I want to avoid using the solid behavior if possible because I still want the player to be able to pass through them, and the enemy pass through each other in certain situations.

    Any help is appreciated.

    Edit: Solved, see below

  • Try something like this:

    Object1 is overlapping Object2 and

    Object1.x < Object2.x, then

    set X of Object1 to Object1.x-1

    This basically moves object1 to the left (if its on the left side) every moment it's overlapping object2. You can do it for the other side (and should) by changing the negative 1 to a positive 1 and the less than to a greater than.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What if they're of the same object?

  • Okay, I got saw your other thread and did some experimenting.


    Put the Enemy in an Family (EnemyGroup)

    For each Enemy

          Enemy is overlapping EnemyGroup

                If EnemyGroup.X < Enemy.X then self.platform.vectorX + 100

                If EnemyGroup.X > Enemy.X then self.platform.vectorX - 100

    Thank you very much for your help

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