KevinnFtw Posted May 29, 2014 Share Posted May 29, 2014 Hi guys,At the moment I'm having some issues detecting which sprite is overlapping another sprite.The overlap function works fine, but I would like to know which of the 2 sprites goes over the other sprite.I only want to execute a certain function if sprite A walks over sprite B, and not if sprite B walks over sprite A.Is there any way I could check this inside of the overlap function?Thanks,Kevin Link to comment Share on other sites More sharing options...
lewster32 Posted May 29, 2014 Share Posted May 29, 2014 Could you not check the current velocities of the items to determine which one was moving at the time? What you're trying to detect presumably is which one is the instigator of the collision - and that problem becomes very difficult to solve if both are moving and neither have a clearly defined 'source' of motion. Maybe you need a flag on your sprites to determine if they're 'walking' or not. Then in the event of a collision, check the flag for both sprites - if one is walking and one is not, then the walking sprite is the instigator, and so do something, otherwise ignore the collision. Like I say this can be quite a difficult problem to solve; and not from a programming perspective but just in general. It certainly forms the basis of automotive insurance KevinnFtw 1 Link to comment Share on other sites More sharing options...
KevinnFtw Posted May 29, 2014 Author Share Posted May 29, 2014 That's a great solution as only one of them is moving at a time. Thanks! lewster32 1 Link to comment Share on other sites More sharing options...
lewster32 Posted May 29, 2014 Share Posted May 29, 2014 You're welcome Link to comment Share on other sites More sharing options...
Recommended Posts