mirror of
https://github.com/photonstorm/phaser
synced 2024-11-28 07:31:11 +00:00
CollideObjects now handles the total setting and returning.
This commit is contained in:
parent
916e59ceb9
commit
0ee93393e3
3 changed files with 6 additions and 10 deletions
|
@ -4,11 +4,7 @@ var Collide = function (object1, object2, collideCallback, processCallback, call
|
|||
if (processCallback === undefined) { processCallback = null; }
|
||||
if (callbackContext === undefined) { callbackContext = collideCallback; }
|
||||
|
||||
this._total = 0;
|
||||
|
||||
this.collideObjects(object1, object2, collideCallback, processCallback, callbackContext, false);
|
||||
|
||||
return (this._total > 0);
|
||||
return this.collideObjects(object1, object2, collideCallback, processCallback, callbackContext, false);
|
||||
};
|
||||
|
||||
module.exports = Collide;
|
||||
|
|
|
@ -4,6 +4,8 @@ var CollideObjects = function (object1, object2, collideCallback, processCallbac
|
|||
var object1isArray = Array.isArray(object1);
|
||||
var object2isArray = Array.isArray(object2);
|
||||
|
||||
this._total = 0;
|
||||
|
||||
if (!object1isArray && !object2isArray)
|
||||
{
|
||||
// Neither of them are arrays - do this first as it's the most common use-case
|
||||
|
@ -36,6 +38,8 @@ var CollideObjects = function (object1, object2, collideCallback, processCallbac
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (this._total > 0);
|
||||
};
|
||||
|
||||
module.exports = CollideObjects;
|
||||
|
|
|
@ -4,11 +4,7 @@ var Overlap = function (object1, object2, overlapCallback, processCallback, call
|
|||
if (processCallback === undefined) { processCallback = null; }
|
||||
if (callbackContext === undefined) { callbackContext = overlapCallback; }
|
||||
|
||||
this._total = 0;
|
||||
|
||||
this.collideObjects(object1, object2, overlapCallback, processCallback, callbackContext, true);
|
||||
|
||||
return (this._total > 0);
|
||||
return this.collideObjects(object1, object2, overlapCallback, processCallback, callbackContext, true);
|
||||
};
|
||||
|
||||
module.exports = Overlap;
|
||||
|
|
Loading…
Reference in a new issue