You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Checks for collision between two game objects. The objects can be Sprites, Groups, Emitters or Tilemap Layers.
435
-
* You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap Layer or Group vs. Tilemap Layer collisions.
436
-
* The objects are also automatically separated.
434
+
* Checks for collision between two game objects. You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap Layer or Group vs. Tilemap Layer collisions.
435
+
* The objects are also automatically separated. If you don't require separation then use ArcadePhysics.overlap instead.
436
+
* An optional processCallback can be provided. If given this function will be called when two sprites are found to be colliding. It is called before any separation takes place,
437
+
* giving you the chance to perform additional checks. If the function returns true then the collision and separation is carried out. If it returns false it is skipped.
438
+
* The collideCallback is an optional function that is only called if two sprites collide. If a processCallback has been set then it needs to return true for collideCallback to be called.
437
439
*
438
440
* @method Phaser.Physics.Arcade#collide
439
441
* @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object1 - The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.Tilemap
440
442
* @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object2 - The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.Tilemap
441
-
* @param {function} [collideCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them.
442
-
* @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collideCallback will only be called if processCallback returns true.
443
+
* @param {function} [collideCallback=null] - An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them.
444
+
* @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collision will only happen if processCallback returns true. The two objects will be passed to this function in the same order in which you specified them.
443
445
* @param {object} [callbackContext] - The context in which to run the callbacks.
444
446
* @returns {boolean} True if a collision occured otherwise false.
* @param {Phaser.Physics.Arcade.Body} body1 - The Body object to separate.
721
698
* @param {Phaser.Physics.Arcade.Body} body2 - The Body object to separate.
722
-
* @returns {boolean} Returns true if the bodies were separated, otherwise false.
699
+
* @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this function is set then the sprites will only be collided if it returns true.
700
+
* @param {object} [callbackContext] - The context in which to run the process callback.
701
+
* @returns {boolean} Returns true if the bodies collided, otherwise false.
0 commit comments