How do I stop sprites overlapping

0 favourites
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.
  • There are so many ways to achieve same results. And they all work

    I Agree with monitz87 and harishankar, post a capx lets get to the bottom of this

  • Cheers guys, my capx is a bit of an unholy mess at the moment but I'll try to mock up something like what I want to achieve and post it up soon. I did manage to get something sort of working with solids, but as before - and even with the refined collision boxes - they glitched around a lot when they clumped up, and sometimes jumped through walls in the tunnels, which isn't ideal!

    Actually I got sort of halfway there with a combination of MoveTo and the Boids flocking behaviours. The mobs chase and keep a good distance from one another without glitching - now I just need to figure out a way to get them to navigate around obstacles.

    monitz87 your solution sounds interesting, I'll definitely give that a go too. I must admit half the functions in MoveTo are a bit of a mystery to me, I just use it as a lazy man's shortcut to something I'd usually do with Custom Movement!

  • Cheers guys, my capx is a bit of an unholy mess at the moment but I'll try to mock up something like what I want to achieve and post it up soon. I did manage to get something sort of working with solids, but as before - and even with the refined collision boxes - they glitched around a lot when they clumped up, and sometimes jumped through walls in the tunnels, which isn't ideal!

    Actually I got sort of halfway there with a combination of MoveTo and the Boids flocking behaviours. The mobs chase and keep a good distance from one another without glitching - now I just need to figure out a way to get them to navigate around obstacles.

    monitz87 your solution sounds interesting, I'll definitely give that a go too. I must admit half the functions in MoveTo are a bit of a mystery to me, I just use it as a lazy man's shortcut to something I'd usually do with Custom Movement!

    Have you had a look at pathfinding? I'm not very good with it.

    Great examples shipped with C2 - its my go to resource from pathfinding to multiplayer.

    Open C2. Click 'New' and scroll down that page.

  • Pathfinding's not really an option for my project unfortunately, as so much of the terrain is destructible it requires frequent regeneration of the obstacle map, which causes stutters - unless there is some more efficient way to do it that I don't know about. Otherwise it'd be ideal.

    EDIT - This is my project by the way, you can see what I mean about the tunnels and obstacles. If you make it to the boss room, he spawns skeletons, which use the Boids/MoveTo combination I described above. However, the boss room's a big open space with no obstacles. I'll keep chipping away at it though, there must be a solution!

    https://dl.dropboxusercontent.com/u/106 ... index.html

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's been several months since you asked, but I've had good results by making a particular object part of a family; even if it's the only one object type.

    This gives you the ability to test collisions/overlap for different instances of the same sprite object. The how can be achieved through different approaches to the logic, but it essentially begins from:

    01 Dude | is overlapping DudeFamily

    02 X Pick DudeFamily by Unique ID| Dude.UID <-----inverted from sprite conditions or you can evaluate the instance UID (as in UID <> UID ) via system conditions

    From this point you have many options, whether you test to see if one is moving faster, or at a particular angle, or pick a random instance picked from the aforementioned conditions; and then apply an every tick condition that moves or rotates one or both sprites with frame-rate independent action.

    The suggestions above regarding an invisible collision-detection sprite work too and you do not have to give it solid behavior--just trigger an event that properly picks the instances and then test some different frame-rate independent actions that correspond to the trigger. This is where our old, wretched friends cos/acos, tan/atan and sin/asin can help provide more accurate behaviors in groups of sprites.

    Jason

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