The simplest form of collision is 1-to-1 collision. You call FlxG.collide()
, optionally setting a callback to trigger when collision happens.
// checks if 2 objects collided, and calls the function `callback` if they do
FlxG.collide(objectA, objectB, callback);