I need a collision detection that has no physics and it's FlxG.overlap(), right? But why it doesn't work? FlxG.collide() works for me but.. how can I remove the physics when I hit the monster with a bullet?

  • 1
    \$\begingroup\$ Please share a bit of your code as a sample. \$\endgroup\$ – ashes999 Oct 21 '13 at 1:08

when FlxG.collide runs, it also moves the colliding bodies apart, so an overlap check right after, will return false. So make sure that the overlap check runs before the collide function kicks in


It is slightly difficult to understand exactly how you are trying to implement it, assuming it is a basic, if overlapping, then do A, this is how it should work.

you will need an object/group:

private var ObjectGroup:FlxGroup;
private var ObjectInGroup:FlxSprite;
private var Object2:FlxSprite;

In your update function or wherever you want to detect the overlap:

FlxG.overlap(Object2, ObjectsGroup, OverlappingObjects);

Then the function that is called:

   private function OverlappingObjects(FirstObject:FlxSprite, SecondObject:FlxSprite){


Now you can do this with two sprites, or two groups, but this is basically how the it should turn out. I have not used the ProcessCallback yet, but I assume you would have a function with a return as a boolean, based upon the description. I could be wrong though.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.