Stop sprites overlapping ...

This forum is currently in read-only mode.
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • Hi.

    I'm making a Llamatron 2112 clone atm and have the baddies homing in on the player as they should. Problem is they start to overlap each other. Is there a way to stop this happening? I've set them to solid and that doesn't work and the only collision options are really to destroy them (unless I've missed something). I end up with one big clump of aliens chasing the player.

    Any help appreciated.

    Thanks.

  • I assume you're using something like Bullet behavior for your enemies (as shown in the Ghost Shooter tutorial). But Bullet behavior doesn't automatically support solid collisions.

    8Direction does. If you use 8Direction behavior on your sprites (be sure to set the user control to "ignored" with an event) and make them Solid, then they will automatically push out of each other if they're overlapping.

    Platform, Ball, and Car behaviors also automatically handle solid collisions. Custom Movement behavior can use actions to tell it how to handle solid collisions. Physics behavior has solid collision too, but it doesn't use the Solid attribute to collide with, rather it only treats other physics objects as solid.

    You could continue to use Bullet behavior, or move them yourself with your own events, but you would have to create your own collision events as well to tell your enemies to push out of each other when they overlap. But, eh... it's just easier to use 8Direction, so why not?

    By the way, you'll probably want to make the collision masks for your enemies a perfect circle if you're going to use 8Direction, you'll get more natural looking crowd behavior out of them that way. If they're rectangular or irregularly shaped then they might get stuck on each other in weird ways.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I was actually just using normal sprites and updating the X and Y depending on the player position. Now I know about the 8 direction auto shoving themselves apart, I'll use that.

    Thanks a lot

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