Adding Type support for collision checks.

This commit is contained in:
Richard Davey
2013-09-12 21:54:41 +01:00
parent 79dc3566f4
commit 9f687b4f8a
13 changed files with 683 additions and 207 deletions
+24
View File
@@ -179,11 +179,35 @@ Phaser.Physics.Arcade.prototype = {
*/
overlap: function (object1, object2, notifyCallback, processCallback, callbackContext) {
object1 = object1 || null;
object2 = object2 || null;
notifyCallback = notifyCallback || null;
processCallback = processCallback || this.separate;
callbackContext = callbackContext || this;
// World vs. World check
if (object1 == null)
{
// Scan the entire display list, comparing every object! (ouch)
if (this.game.world._container.first._iNext)
{
var currentNode = this.game.world._container.first._iNext;
do
{
if (checkExists == false || (checkExists && currentNode.exists))
{
callback.call(callbackContext, currentNode);
}
currentNode = currentNode._iNext;
}
while (currentNode != this.game.world._container.last._iNext);
}
}
// Get the ships top-most ID. If the length of that ID is 1 then we can ignore every other result,
// it's simply not colliding with anything :)
var potentials = this.quadTree.retrieve(object1);