n-way collision checks and onBeginContact and onEndContact done and working. Also fixed issue in TweenManager.removeAll.

This commit is contained in:
photonstorm
2014-02-05 16:54:58 +00:00
parent 4502ca1bf6
commit 84f0f00f49
10 changed files with 492 additions and 286 deletions
+13 -2
View File
@@ -125,6 +125,13 @@ Phaser.Tween = function (object, game) {
*/
this._onUpdateCallback = null;
/**
* @property {object} _onUpdateCallbackContext - The context in which to call the onUpdate callback.
* @private
* @default null
*/
this._onUpdateCallbackContext = null;
/**
* @property {number} _pausedTime - Private pause timer.
* @private
@@ -293,6 +300,8 @@ Phaser.Tween.prototype = {
this.isRunning = false;
this._onUpdateCallback = null;
this._manager.remove(this);
return this;
@@ -411,9 +420,11 @@ Phaser.Tween.prototype = {
* @param {function} callback - The callback to invoke each time this tween is updated.
* @return {Phaser.Tween} Itself.
*/
onUpdateCallback: function (callback) {
onUpdateCallback: function (callback, callbackContext) {
this._onUpdateCallback = callback;
this._onUpdateCallbackContext = callbackContext;
return this;
},
@@ -506,7 +517,7 @@ Phaser.Tween.prototype = {
if (this._onUpdateCallback !== null)
{
this._onUpdateCallback.call(this._object, value);
this._onUpdateCallback.call(this._onUpdateCallbackContext, this, value);
}
if (elapsed == 1)
+9 -11
View File
@@ -28,13 +28,13 @@ Phaser.TweenManager = function (game) {
this.game = game;
/**
* @property {array} _tweens - Description.
* @property {array<Phaser.Tween>} _tweens - All of the currently running tweens.
* @private
*/
this._tweens = [];
/**
* @property {array} _add - Description.
* @property {array<Phaser.Tween>} _add - All of the tweens queued to be added in the next update.
* @private
*/
this._add = [];
@@ -46,13 +46,6 @@ Phaser.TweenManager = function (game) {
Phaser.TweenManager.prototype = {
/**
* Version number of this library.
* @property {string} REVISION
* @default
*/
REVISION: '11dev',
/**
* Get all the tween objects in an array.
* @method Phaser.TweenManager#getAll
@@ -65,12 +58,17 @@ Phaser.TweenManager.prototype = {
},
/**
* Remove all tween objects.
* Remove all tweens running and in the queue. Doesn't call any of the tween onComplete events.
* @method Phaser.TweenManager#removeAll
*/
removeAll: function () {
this._tweens = [];
for (var i = 0; i < this._tweens.length; i++)
{
this._tweens[i].pendingDelete = true;
}
this._add = [];
},