diff --git a/README.md b/README.md index 892a50f9..5d0891d6 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,9 @@ Version 1.1.2 * Fixed issue 135 - Added typeof checks into most ArcadePhysics functions to avoid errors with zero values. * Fixed issue 136 - distanceTo using worldX/Y instead of x/y. * Fixed lots of examples where the cursor keys / space bar were not locked from moving the browser page (if you find any more, please tell us!) +* Fixed issue 149 - Starling XML files now load properly again, also created an Example to show use of them (thanks haden) +* Fixed an issue where if the Starling XML file didn't contain a frameX/Y value it would crash on import. +* Fixed the Multiple Animations Example - it's now a lovely underwater scene :) diff --git a/build/phaser.js b/build/phaser.js index 3c15339d..2d203c2d 100644 --- a/build/phaser.js +++ b/build/phaser.js @@ -18,7 +18,7 @@ * * Phaser - http://www.phaser.io * -* v1.1.1 - Built at: Sat Oct 26 2013 19:10:41 +* v1.1.1 - Built at: Thu Oct 31 2013 15:44:20 * * By Richard Davey http://www.photonstorm.com @photonstorm * @@ -7397,15 +7397,8 @@ Phaser.Camera.prototype = { this.checkBounds(); } - if (this.view.x !== -this.displayObject.position.x) - { - this.displayObject.position.x = -this.view.x; - } - - if (this.view.y !== -this.displayObject.position.y) - { - this.displayObject.position.y = -this.view.y; - } + this.displayObject.position.x = -this.view.x; + this.displayObject.position.y = -this.view.y; }, @@ -8049,7 +8042,7 @@ Phaser.StateManager.prototype = { // Already got a state running? if (this.current) { - this.onShutDownCallback.call(this.callbackContext); + this.onShutDownCallback.call(this.callbackContext, this.game); } if (clearWorld) @@ -8071,7 +8064,7 @@ Phaser.StateManager.prototype = { { // console.log('Preload Callback found'); this.game.load.reset(); - this.onPreloadCallback.call(this.callbackContext); + this.onPreloadCallback.call(this.callbackContext, this.game); // Is the loader empty? if (this.game.load.queueSize == 0) @@ -8198,7 +8191,7 @@ Phaser.StateManager.prototype = { this.current = key; this._created = false; - this.onInitCallback.call(this.callbackContext); + this.onInitCallback.call(this.callbackContext, this.game); }, @@ -8214,7 +8207,7 @@ Phaser.StateManager.prototype = { { // console.log('Create callback found'); this._created = true; - this.onCreateCallback.call(this.callbackContext); + this.onCreateCallback.call(this.callbackContext, this.game); } else { @@ -8231,13 +8224,13 @@ Phaser.StateManager.prototype = { if (this._created && this.onUpdateCallback) { - this.onUpdateCallback.call(this.callbackContext); + this.onUpdateCallback.call(this.callbackContext, this.game); } else { if (this.onLoadUpdateCallback) { - this.onLoadUpdateCallback.call(this.callbackContext); + this.onLoadUpdateCallback.call(this.callbackContext, this.game); } } @@ -8251,7 +8244,7 @@ Phaser.StateManager.prototype = { if (this.onPreRenderCallback) { - this.onPreRenderCallback.call(this.callbackContext); + this.onPreRenderCallback.call(this.callbackContext, this.game); } }, @@ -8264,13 +8257,13 @@ Phaser.StateManager.prototype = { if (this._created && this.onRenderCallback) { - this.onRenderCallback.call(this.callbackContext); + this.onRenderCallback.call(this.callbackContext, this.game); } else { if (this.onLoadRenderCallback) { - this.onLoadRenderCallback.call(this.callbackContext); + this.onLoadRenderCallback.call(this.callbackContext, this.game); } } @@ -9140,6 +9133,13 @@ Phaser.PluginManager.prototype = { } this._pluginsLength = this.plugins.push(plugin); + + // Allows plugins to run potentially destructive code outside of the constructor, and only if being added to the PluginManager + if (typeof plugin['init'] === 'function') + { + plugin.init(); + } + return plugin; } else @@ -9422,7 +9422,7 @@ Phaser.Stage.prototype = { /** * @name Phaser.Stage#backgroundColor -* @property {number|string} paused - Gets and sets the background color of the stage. The color can be given as a number: 0xff0000 or a hex string: '#ff0000' +* @property {number|string} backgroundColor - Gets and sets the background color of the stage. The color can be given as a number: 0xff0000 or a hex string: '#ff0000' */ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", { @@ -9434,12 +9434,20 @@ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", { this._backgroundColor = color; - if (typeof color === 'string') + if (this.game.renderType == Phaser.CANVAS) { - color = Phaser.Color.hexToRGB(color); + // Set it directly, this allows us to use rgb alpha values in Canvas mode. + this._stage.backgroundColorString = color; } + else + { + if (typeof color === 'string') + { + color = Phaser.Color.hexToRGB(color); + } - this._stage.setBackgroundColor(color); + this._stage.setBackgroundColor(color); + } } @@ -10974,16 +10982,16 @@ Object.defineProperty(Phaser.World.prototype, "randomY", { * @class Phaser.Game * @classdesc This is where the magic happens. The Game object is the heart of your game, * providing quick access to common functions and handling the boot process. -*
"Hell, there are no rules here - we're trying to accomplish something."
Button object.
+* Create a new `Button` object. A Button is a special type of Sprite that is set-up to handle Pointer events automatically. The four states a Button responds to are:
+* 'Over' - when the Pointer moves over the Button. This is also commonly known as 'hover'.
+* 'Out' - when the Pointer that was previously over the Button moves out of it.
+* 'Down' - when the Pointer is pressed down on the Button. I.e. touched on a touch enabled device or clicked with the mouse.
+* 'Up' - when the Pointer that was pressed down on the Button is released again.
+* You can set a unique texture frame and Sound for any of these states.
+*
* @class Phaser.Button
* @constructor
*
* @param {Phaser.Game} game Current game instance.
-* @param {number} [x] X position of the button.
-* @param {number} [y] Y position of the button.
-* @param {string} [key] The image key as defined in the Game.Cache to use as the texture for this button.
-* @param {function} [callback] The function to call when this button is pressed
-* @param {object} [callbackContext] The context in which the callback will be called (usually 'this')
-* @param {string|number} [overFrame] This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
-* @param {string|number} [outFrame] This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
-* @param {string|number} [downFrame] This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
+* @param {number} [x] - X position of the Button.
+* @param {number} [y] - Y position of the Button.
+* @param {string} [key] - The image key as defined in the Game.Cache to use as the texture for this Button.
+* @param {function} [callback] - The function to call when this Button is pressed.
+* @param {object} [callbackContext] - The context in which the callback will be called (usually 'this').
+* @param {string|number} [overFrame] - This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
+* @param {string|number} [outFrame] - This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
+* @param {string|number} [downFrame] - This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
*/
Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame) {
@@ -17452,87 +17448,139 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame,
Phaser.Sprite.call(this, game, x, y, key, outFrame);
/**
- * @property {Description} type - Description.
+ * @property {number} type - The Phaser Object Type.
*/
this.type = Phaser.BUTTON;
/**
- * @property {Description} _onOverFrameName - Description.
+ * @property {string} _onOverFrameName - Internal variable.
* @private
* @default
*/
this._onOverFrameName = null;
/**
- * @property {Description} _onOutFrameName - Description.
+ * @property {string} _onOutFrameName - Internal variable.
* @private
* @default
*/
this._onOutFrameName = null;
/**
- * @property {Description} _onDownFrameName - Description.
+ * @property {string} _onDownFrameName - Internal variable.
* @private
* @default
*/
this._onDownFrameName = null;
/**
- * @property {Description} _onUpFrameName - Description.
+ * @property {string} _onUpFrameName - Internal variable.
* @private
* @default
*/
this._onUpFrameName = null;
/**
- * @property {Description} _onOverFrameID - Description.
+ * @property {number} _onOverFrameID - Internal variable.
* @private
* @default
*/
this._onOverFrameID = null;
/**
- * @property {Description} _onOutFrameID - Description.
+ * @property {number} _onOutFrameID - Internal variable.
* @private
* @default
*/
this._onOutFrameID = null;
/**
- * @property {Description} _onDownFrameID - Description.
+ * @property {number} _onDownFrameID - Internal variable.
* @private
* @default
*/
this._onDownFrameID = null;
/**
- * @property {Description} _onUpFrameID - Description.
+ * @property {number} _onUpFrameID - Internal variable.
* @private
* @default
*/
this._onUpFrameID = null;
- // These are the signals the game will subscribe to
+ /**
+ * @property {Phaser.Sound} onOverSound - The Sound to be played when this Buttons Over state is activated.
+ * @default
+ */
+ this.onOverSound = null;
+
+ /**
+ * @property {Phaser.Sound} onOutSound - The Sound to be played when this Buttons Out state is activated.
+ * @default
+ */
+ this.onOutSound = null;
+
+ /**
+ * @property {Phaser.Sound} onDownSound - The Sound to be played when this Buttons Down state is activated.
+ * @default
+ */
+ this.onDownSound = null;
+
+ /**
+ * @property {Phaser.Sound} onUpSound - The Sound to be played when this Buttons Up state is activated.
+ * @default
+ */
+ this.onUpSound = null;
+
+ /**
+ * @property {string} onOverSoundMarker - The Sound Marker used in conjunction with the onOverSound.
+ * @default
+ */
+ this.onOverSoundMarker = '';
+
+ /**
+ * @property {string} onOutSoundMarker - The Sound Marker used in conjunction with the onOutSound.
+ * @default
+ */
+ this.onOutSoundMarker = '';
+
+ /**
+ * @property {string} onDownSoundMarker - The Sound Marker used in conjunction with the onDownSound.
+ * @default
+ */
+ this.onDownSoundMarker = '';
+
+ /**
+ * @property {string} onUpSoundMarker - The Sound Marker used in conjunction with the onUpSound.
+ * @default
+ */
+ this.onUpSoundMarker = '';
+
/**
- * @property {Phaser.Signal} onInputOver - Description.
+ * @property {Phaser.Signal} onInputOver - The Signal (or event) dispatched when this Button is in an Over state.
*/
this.onInputOver = new Phaser.Signal;
/**
- * @property {Phaser.Signal} onInputOut - Description.
+ * @property {Phaser.Signal} onInputOut - The Signal (or event) dispatched when this Button is in an Out state.
*/
this.onInputOut = new Phaser.Signal;
/**
- * @property {Phaser.Signal} onInputDown - Description.
+ * @property {Phaser.Signal} onInputDown - The Signal (or event) dispatched when this Button is in an Down state.
*/
this.onInputDown = new Phaser.Signal;
/**
- * @property {Phaser.Signal} onInputUp - Description.
+ * @property {Phaser.Signal} onInputUp - The Signal (or event) dispatched when this Button is in an Up state.
*/
this.onInputUp = new Phaser.Signal;
+ /**
+ * @property {boolean} freezeFrames - When true the Button will cease to change texture frame on all events (over, out, up, down).
+ */
+ this.freezeFrames = false;
+
this.setFrames(overFrame, outFrame, downFrame);
if (callback !== null)
@@ -17540,8 +17588,6 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame,
this.onInputUp.add(callback, callbackContext);
}
- this.freezeFrames = false;
-
this.input.start(0, true);
// Redirect the input events to here so we can handle animation updates, etc
@@ -17637,10 +17683,131 @@ Phaser.Button.prototype.setFrames = function (overFrame, outFrame, downFrame) {
};
/**
-* Description.
+* Sets the sounds to be played whenever this Button is interacted with. Sounds can be either full Sound objects, or markers pointing to a section of a Sound object.
+* The most common forms of sounds are 'hover' effects and 'click' effects, which is why the order of the parameters is overSound then downSound.
+* Call this function with no parameters at all to reset all sounds on this Button.
*
+* @method Phaser.Button.prototype.setSounds
+* @param {Phaser.Sound} [overSound] - Over Button Sound.
+* @param {string} [overMarker] - Over Button Sound Marker.
+* @param {Phaser.Sound} [downSound] - Down Button Sound.
+* @param {string} [downMarker] - Down Button Sound Marker.
+* @param {Phaser.Sound} [outSound] - Out Button Sound.
+* @param {string} [outMarker] - Out Button Sound Marker.
+* @param {Phaser.Sound} [upSound] - Up Button Sound.
+* @param {string} [upMarker] - Up Button Sound Marker.
+*/
+Phaser.Button.prototype.setSounds = function (overSound, overMarker, downSound, downMarker, outSound, outMarker, upSound, upMarker) {
+
+ this.setOverSound(overSound, overMarker);
+ this.setOutSound(outSound, outMarker);
+ this.setUpSound(upSound, upMarker);
+ this.setDownSound(downSound, downMarker);
+
+}
+
+/**
+* The Sound to be played when a Pointer moves over this Button.
+*
+* @method Phaser.Button.prototype.setOverSound
+* @param {Phaser.Sound} sound - The Sound that will be played.
+* @param {string} [marker] - A Sound Marker that will be used in the playback.
+*/
+Phaser.Button.prototype.setOverSound = function (sound, marker) {
+
+ this.onOverSound = null;
+ this.onOverSoundMarker = '';
+
+ if (sound instanceof Phaser.Sound)
+ {
+ this.onOverSound = sound;
+ }
+
+ if (typeof marker === 'string')
+ {
+ this.onOverSoundMarker = marker;
+ }
+
+}
+
+/**
+* The Sound to be played when a Pointer moves out of this Button.
+*
+* @method Phaser.Button.prototype.setOutSound
+* @param {Phaser.Sound} sound - The Sound that will be played.
+* @param {string} [marker] - A Sound Marker that will be used in the playback.
+*/
+Phaser.Button.prototype.setOutSound = function (sound, marker) {
+
+ this.onOutSound = null;
+ this.onOutSoundMarker = '';
+
+ if (sound instanceof Phaser.Sound)
+ {
+ this.onOutSound = sound;
+ }
+
+ if (typeof marker === 'string')
+ {
+ this.onOutSoundMarker = marker;
+ }
+
+}
+
+/**
+* The Sound to be played when a Pointer clicks on this Button.
+*
+* @method Phaser.Button.prototype.setUpSound
+* @param {Phaser.Sound} sound - The Sound that will be played.
+* @param {string} [marker] - A Sound Marker that will be used in the playback.
+*/
+Phaser.Button.prototype.setUpSound = function (sound, marker) {
+
+ this.onUpSound = null;
+ this.onUpSoundMarker = '';
+
+ if (sound instanceof Phaser.Sound)
+ {
+ this.onUpSound = sound;
+ }
+
+ if (typeof marker === 'string')
+ {
+ this.onUpSoundMarker = marker;
+ }
+
+}
+
+/**
+* The Sound to be played when a Pointer clicks on this Button.
+*
+* @method Phaser.Button.prototype.setDownSound
+* @param {Phaser.Sound} sound - The Sound that will be played.
+* @param {string} [marker] - A Sound Marker that will be used in the playback.
+*/
+Phaser.Button.prototype.setDownSound = function (sound, marker) {
+
+ this.onDownSound = null;
+ this.onDownSoundMarker = '';
+
+ if (sound instanceof Phaser.Sound)
+ {
+ this.onDownSound = sound;
+ }
+
+ if (typeof marker === 'string')
+ {
+ this.onDownSoundMarker = marker;
+ }
+
+}
+
+/**
+* Internal function that handles input events.
+*
+* @protected
* @method Phaser.Button.prototype.onInputOverHandler
-* @param {Description} pointer - Description.
+* @param {Phaser.Pointer} pointer - The Pointer that activated the Button.
*/
Phaser.Button.prototype.onInputOverHandler = function (pointer) {
@@ -17656,6 +17823,11 @@ Phaser.Button.prototype.onInputOverHandler = function (pointer) {
}
}
+ if (this.onOverSound)
+ {
+ this.onOverSound.play(this.onOverSoundMarker);
+ }
+
if (this.onInputOver)
{
this.onInputOver.dispatch(this, pointer);
@@ -17663,10 +17835,11 @@ Phaser.Button.prototype.onInputOverHandler = function (pointer) {
};
/**
-* Description.
+* Internal function that handles input events.
*
-* @method Phaser.Button.prototype.onInputOutHandler
-* @param {Description} pointer - Description.
+* @protected
+* @method Phaser.Button.prototype.onInputOverHandler
+* @param {Phaser.Pointer} pointer - The Pointer that activated the Button.
*/
Phaser.Button.prototype.onInputOutHandler = function (pointer) {
@@ -17682,6 +17855,11 @@ Phaser.Button.prototype.onInputOutHandler = function (pointer) {
}
}
+ if (this.onOutSound)
+ {
+ this.onOutSound.play(this.onOutSoundMarker);
+ }
+
if (this.onInputOut)
{
this.onInputOut.dispatch(this, pointer);
@@ -17689,10 +17867,11 @@ Phaser.Button.prototype.onInputOutHandler = function (pointer) {
};
/**
-* Description.
+* Internal function that handles input events.
*
-* @method Phaser.Button.prototype.onInputDownHandler
-* @param {Description} pointer - Description.
+* @protected
+* @method Phaser.Button.prototype.onInputOverHandler
+* @param {Phaser.Pointer} pointer - The Pointer that activated the Button.
*/
Phaser.Button.prototype.onInputDownHandler = function (pointer) {
@@ -17708,6 +17887,11 @@ Phaser.Button.prototype.onInputDownHandler = function (pointer) {
}
}
+ if (this.onDownSound)
+ {
+ this.onDownSound.play(this.onDownSoundMarker);
+ }
+
if (this.onInputDown)
{
this.onInputDown.dispatch(this, pointer);
@@ -17715,10 +17899,11 @@ Phaser.Button.prototype.onInputDownHandler = function (pointer) {
};
/**
-* Description.
+* Internal function that handles input events.
*
-* @method Phaser.Button.prototype.onInputUpHandler
-* @param {Description} pointer - Description.
+* @protected
+* @method Phaser.Button.prototype.onInputOverHandler
+* @param {Phaser.Pointer} pointer - The Pointer that activated the Button.
*/
Phaser.Button.prototype.onInputUpHandler = function (pointer) {
@@ -17734,6 +17919,11 @@ Phaser.Button.prototype.onInputUpHandler = function (pointer) {
}
}
+ if (this.onUpSound)
+ {
+ this.onUpSound.play(this.onUpSoundMarker);
+ }
+
if (this.onInputUp)
{
this.onInputUp.dispatch(this, pointer);
@@ -23316,9 +23506,10 @@ Phaser.Tween.prototype = {
*/
stop: function () {
- this._manager.remove(this);
this.isRunning = false;
+ this._manager.remove(this);
+
return this;
},
@@ -24654,12 +24845,14 @@ Phaser.AnimationManager.prototype = {
{
if (this.currentAnim.isPlaying == false)
{
+ this.currentAnim.paused = false;
return this.currentAnim.play(frameRate, loop, killOnComplete);
}
}
else
{
this.currentAnim = this._anims[name];
+ this.currentAnim.paused = false;
return this.currentAnim.play(frameRate, loop, killOnComplete);
}
}
@@ -25018,6 +25211,7 @@ Phaser.Animation.prototype = {
this.isPlaying = true;
this.isFinished = false;
+ this.paused = false;
this._timeLastFrame = this.game.time.now;
this._timeNextFrame = this.game.time.now + this.delay;
@@ -25046,6 +25240,7 @@ Phaser.Animation.prototype = {
this.isPlaying = true;
this.isFinished = false;
+ this.paused = false;
this._timeLastFrame = this.game.time.now;
this._timeNextFrame = this.game.time.now + this.delay;
@@ -25069,6 +25264,7 @@ Phaser.Animation.prototype = {
this.isPlaying = false;
this.isFinished = true;
+ this.paused = false;
if (resetFrame)
{
@@ -25171,6 +25367,7 @@ Phaser.Animation.prototype = {
this.isPlaying = false;
this.isFinished = true;
+ this.paused = false;
if (this._parent.events)
{
@@ -25988,55 +26185,61 @@ Phaser.AnimationParser = {
var data = new Phaser.FrameData();
var frames = xml.getElementsByTagName('SubTexture');
var newFrame;
+
+ var uuid;
+ var frame;
+ var x;
+ var y;
+ var width;
+ var height;
+ var frameX;
+ var frameY;
+ var frameWidth;
+ var frameHeight;
for (var i = 0; i < frames.length; i++)
{
- var uuid = game.rnd.uuid();
+ uuid = game.rnd.uuid();
- var frame = frames[i].attributes;
+ frame = frames[i].attributes;
- newFrame = data.addFrame(new Phaser.Frame(
- i,
- frame.x.nodeValue,
- frame.y.nodeValue,
- frame.width.nodeValue,
- frame.height.nodeValue,
- frame.name.nodeValue,
- uuid
- ));
+ name = frame.name.nodeValue;
+ x = parseInt(frame.x.nodeValue);
+ y = parseInt(frame.y.nodeValue);
+ width = parseInt(frame.width.nodeValue);
+ height = parseInt(frame.height.nodeValue);
+
+ frameX = null;
+ frameY = null;
+
+ if (frame.frameX)
+ {
+ frameX = Math.abs(parseInt(frame.frameX.nodeValue));
+ frameY = Math.abs(parseInt(frame.frameY.nodeValue));
+ frameWidth = parseInt(frame.frameWidth.nodeValue);
+ frameHeight = parseInt(frame.frameHeight.nodeValue);
+ }
+
+ newFrame = data.addFrame(new Phaser.Frame(i, x, y, width, height, name, uuid));
PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
- x: frame.x.nodeValue,
- y: frame.y.nodeValue,
- width: frame.width.nodeValue,
- height: frame.height.nodeValue
+ x: x,
+ y: y,
+ width: width,
+ height: height
});
// Trimmed?
- if (frame.frameX.nodeValue != '-0' || frame.frameY.nodeValue != '-0')
+ if (frameX !== null || frameY !== null)
{
- newFrame.setTrim(
- true,
- frame.width.nodeValue,
- frame.height.nodeValue,
- Math.abs(frame.frameX.nodeValue),
- Math.abs(frame.frameY.nodeValue),
- frame.frameWidth.nodeValue,
- frame.frameHeight.nodeValue
- );
+ newFrame.setTrim(true, width, height, frameX, frameY, frameWidth, frameHeight);
- PIXI.TextureCache[uuid].realSize = {
- x: Math.abs(frame.frameX.nodeValue),
- y: Math.abs(frame.frameY.nodeValue),
- w: frame.frameWidth.nodeValue,
- h: frame.frameHeight.nodeValue
- };
+ PIXI.TextureCache[uuid].realSize = { x: frameX, y: frameY, w: frameWidth, h: frameHeight };
// We had to hack Pixi to get this to work :(
PIXI.TextureCache[uuid].trimmed = true;
- PIXI.TextureCache[uuid].trim.x = Math.abs(frame.frameX.nodeValue);
- PIXI.TextureCache[uuid].trim.y = Math.abs(frame.frameY.nodeValue);
-
+ PIXI.TextureCache[uuid].trim.x = frameX;
+ PIXI.TextureCache[uuid].trim.y = frameY;
}
}
@@ -29871,13 +30074,21 @@ Phaser.Utils.Debug.prototype = {
this.start(x, y, color);
- this.line(sprite.name);
+ if (sprite.name)
+ {
+ this.line(sprite.name);
+ }
+
this.line('x: ' + sprite.x);
this.line('y: ' + sprite.y);
+ this.line('pos x: ' + sprite.position.x);
+ this.line('pos y: ' + sprite.position.y);
this.line('local x: ' + sprite.localTransform[2]);
this.line('local y: ' + sprite.localTransform[5]);
- this.line('world x: ' + sprite.worldTransform[2]);
- this.line('world y: ' + sprite.worldTransform[5]);
+ this.line('t x: ' + sprite.worldTransform[2]);
+ this.line('t y: ' + sprite.worldTransform[5]);
+ this.line('world x: ' + sprite.world.x);
+ this.line('world y: ' + sprite.world.y);
this.stop();
@@ -30236,6 +30447,11 @@ Phaser.Color = {
hexToRGB: function (h) {
var hex16 = (h.charAt(0) == "#") ? h.substring(1, 7) : h;
+
+ if (hex16.length==3) {
+ hex16 = hex16.charAt(0) + hex16.charAt(0) + hex16.charAt(1) + hex16.charAt(1) + hex16.charAt(2) + hex16.charAt(2);
+ }
+
var red = parseInt(hex16.substring(0, 2), 16);
var green = parseInt(hex16.substring(2, 4), 16);
var blue = parseInt(hex16.substring(4, 6), 16);
@@ -30920,28 +31136,25 @@ Phaser.Physics.Arcade.prototype = {
this._mapData = tilemapLayer.getTiles(sprite.body.x, sprite.body.y, sprite.body.width, sprite.body.height, true);
- if (this._mapData.length > 1)
+ // console.log('getTiles', this._tx, this._ty);
+ if (this.game.input.keyboard.isDown(Phaser.Keyboard.SHIFT))
{
- for (var i = 1; i < this._mapData.length; i++)
+ console.log('cst', this._mapData, sprite.body.x, sprite.body.y);
+ }
+
+ if (this._mapData.length == 0)
+ {
+ return;
+ }
+
+ for (var i = 0; i < this._mapData.length; i++)
+ {
+ if (this.separateTile(sprite.body, this._mapData[i]))
{
- this.separateTile(sprite.body, this._mapData[i]);
-
- if (this._result)
+ // They collided, is there a custom process callback?
+ if (processCallback)
{
- // They collided, is there a custom process callback?
- if (processCallback)
- {
- if (processCallback.call(callbackContext, sprite, this._mapData[i]))
- {
- this._total++;
-
- if (collideCallback)
- {
- collideCallback.call(callbackContext, sprite, this._mapData[i]);
- }
- }
- }
- else
+ if (processCallback.call(callbackContext, sprite, this._mapData[i]))
{
this._total++;
@@ -30951,6 +31164,15 @@ Phaser.Physics.Arcade.prototype = {
}
}
}
+ else
+ {
+ this._total++;
+
+ if (collideCallback)
+ {
+ collideCallback.call(callbackContext, sprite, this._mapData[i]);
+ }
+ }
}
}
@@ -31374,14 +31596,15 @@ Phaser.Physics.Arcade.prototype = {
this._overlap = 0;
// The hulls overlap, let's process it
- this._maxOverlap = body.deltaAbsX() + this.OVERLAP_BIAS;
+ // this._maxOverlap = body.deltaAbsX() + this.OVERLAP_BIAS;
if (body.deltaX() < 0)
{
// Moving left
this._overlap = tile.right - body.hullX.x;
- if ((this._overlap > this._maxOverlap) || body.allowCollision.left == false || tile.tile.collideRight == false)
+ // if ((this._overlap > this._maxOverlap) || body.allowCollision.left == false || tile.tile.collideRight == false)
+ if (body.allowCollision.left == false || tile.tile.collideRight == false)
{
this._overlap = 0;
}
@@ -31395,7 +31618,8 @@ Phaser.Physics.Arcade.prototype = {
// Moving right
this._overlap = body.hullX.right - tile.x;
- if ((this._overlap > this._maxOverlap) || body.allowCollision.right == false || tile.tile.collideLeft == false)
+ // if ((this._overlap > this._maxOverlap) || body.allowCollision.right == false || tile.tile.collideLeft == false)
+ if (body.allowCollision.right == false || tile.tile.collideLeft == false)
{
this._overlap = 0;
}
@@ -31458,14 +31682,15 @@ Phaser.Physics.Arcade.prototype = {
this._overlap = 0;
// The hulls overlap, let's process it
- this._maxOverlap = body.deltaAbsY() + this.OVERLAP_BIAS;
+ // this._maxOverlap = body.deltaAbsY() + this.OVERLAP_BIAS;
if (body.deltaY() < 0)
{
// Moving up
this._overlap = tile.bottom - body.hullY.y;
- if ((this._overlap > this._maxOverlap) || body.allowCollision.up == false || tile.tile.collideDown == false)
+ // if ((this._overlap > this._maxOverlap) || body.allowCollision.up == false || tile.tile.collideDown == false)
+ if (body.allowCollision.up == false || tile.tile.collideDown == false)
{
this._overlap = 0;
}
@@ -31479,7 +31704,8 @@ Phaser.Physics.Arcade.prototype = {
// Moving down
this._overlap = body.hullY.bottom - tile.y;
- if ((this._overlap > this._maxOverlap) || body.allowCollision.down == false || tile.tile.collideUp == false)
+ // if ((this._overlap > this._maxOverlap) || body.allowCollision.down == false || tile.tile.collideUp == false)
+ if (body.allowCollision.down == false || tile.tile.collideUp == false)
{
this._overlap = 0;
}
@@ -31541,8 +31767,8 @@ Phaser.Physics.Arcade.prototype = {
*/
moveToObject: function (displayObject, destination, speed, maxTime) {
- speed = speed || 60;
- maxTime = maxTime || 0;
+ if (typeof speed === 'undefined') { speed = 60; }
+ if (typeof maxTime === 'undefined') { maxTime = 0; }
this._angle = Math.atan2(destination.y - displayObject.y, destination.x - displayObject.x);
@@ -31575,9 +31801,9 @@ Phaser.Physics.Arcade.prototype = {
*/
moveToPointer: function (displayObject, speed, pointer, maxTime) {
- speed = speed || 60;
+ if (typeof speed === 'undefined') { speed = 60; }
pointer = pointer || this.game.input.activePointer;
- maxTime = maxTime || 0;
+ if (typeof maxTime === 'undefined') { maxTime = 0; }
this._angle = this.angleToPointer(displayObject, pointer);
@@ -31612,8 +31838,8 @@ Phaser.Physics.Arcade.prototype = {
*/
moveToXY: function (displayObject, x, y, speed, maxTime) {
- speed = speed || 60;
- maxTime = maxTime || 0;
+ if (typeof speed === 'undefined') { speed = 60; }
+ if (typeof maxTime === 'undefined') { maxTime = 0; }
this._angle = Math.atan2(y - displayObject.y, x - displayObject.x);
@@ -31642,7 +31868,7 @@ Phaser.Physics.Arcade.prototype = {
*/
velocityFromAngle: function (angle, speed, point) {
- speed = speed || 60;
+ if (typeof speed === 'undefined') { speed = 60; }
point = point || new Phaser.Point;
return point.setTo((Math.cos(this.game.math.degToRad(angle)) * speed), (Math.sin(this.game.math.degToRad(angle)) * speed));
@@ -31661,7 +31887,7 @@ Phaser.Physics.Arcade.prototype = {
*/
velocityFromRotation: function (rotation, speed, point) {
- speed = speed || 60;
+ if (typeof speed === 'undefined') { speed = 60; }
point = point || new Phaser.Point;
return point.setTo((Math.cos(rotation) * speed), (Math.sin(rotation) * speed));
@@ -31680,7 +31906,7 @@ Phaser.Physics.Arcade.prototype = {
*/
accelerationFromRotation: function (rotation, speed, point) {
- speed = speed || 60;
+ if (typeof speed === 'undefined') { speed = 60; }
point = point || new Phaser.Point;
return point.setTo((Math.cos(rotation) * speed), (Math.sin(rotation) * speed));
@@ -31827,8 +32053,8 @@ Phaser.Physics.Arcade.prototype = {
pointer = pointer || this.game.input.activePointer;
- this._dx = displayObject.worldX - pointer.x;
- this._dy = displayObject.worldY - pointer.y;
+ this._dx = displayObject.x - pointer.x;
+ this._dy = displayObject.y - pointer.y;
return Math.sqrt(this._dx * this._dx + this._dy * this._dy);
@@ -31996,6 +32222,11 @@ Phaser.Physics.Arcade.Body = function (sprite) {
*/
this.halfHeight = Math.floor(sprite.currentFrame.sourceSizeH / 2);
+ /**
+ * @property {Phaser.Point} center - The center coordinate of the Physics Body.
+ */
+ this.center = new Phaser.Point(this.x + this.halfWidth, this.y + this.halfHeight);
+
/**
* @property {number} _sx - Internal cache var.
* @private
@@ -32215,6 +32446,7 @@ Phaser.Physics.Arcade.Body.prototype = {
this.halfHeight = Math.floor(this.height / 2);
this._sx = scaleX;
this._sy = scaleY;
+ this.center.setTo(this.x + this.halfWidth, this.y + this.halfHeight);
}
},
@@ -32245,8 +32477,8 @@ Phaser.Physics.Arcade.Body.prototype = {
this.screenX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
this.screenY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
- this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
- this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
+ this.preX = (this.sprite.world.x - (this.sprite.anchor.x * this.width)) + this.offset.x;
+ this.preY = (this.sprite.world.y - (this.sprite.anchor.y * this.height)) + this.offset.y;
this.preRotation = this.sprite.angle;
@@ -32263,7 +32495,8 @@ Phaser.Physics.Arcade.Body.prototype = {
this.checkWorldBounds();
}
- this.updateHulls();Array }
+ this.updateHulls();
+ }
if (this.skipQuadTree == false && this.allowCollision.none == false && this.sprite.visible && this.sprite.alive)
{
@@ -32282,16 +32515,6 @@ Phaser.Physics.Arcade.Body.prototype = {
*/
postUpdate: function () {
- // Calculate forward-facing edge
- if (this.deltaX() == 0 && this.deltaY() == 0)
- {
- // Can't work it out from the Body, how about from x position?
- if (this.sprite.deltaX() == 0 && this.sprite.deltaY() == 0)
- {
- // still as a statue
- }
- }
-
if (this.deltaX() < 0)
{
this.facing = Phaser.LEFT;
@@ -32310,8 +32533,12 @@ Phaser.Physics.Arcade.Body.prototype = {
this.facing = Phaser.DOWN;
}
- this.sprite.x += this.deltaX();
- this.sprite.y += this.deltaY();
+ if (this.deltaX() !== 0 || this.deltaY() !== 0)
+ {
+ this.sprite.x += this.deltaX();
+ this.sprite.y += this.deltaY();
+ this.center.setTo(this.x + this.halfWidth, this.y + this.halfHeight);
+ }
if (this.allowRotation)
{
@@ -32389,6 +32616,8 @@ Phaser.Physics.Arcade.Body.prototype = {
this.halfHeight = Math.floor(this.height / 2);
this.offset.setTo(offsetX, offsetY);
+ this.center.setTo(this.x + this.halfWidth, this.y + this.halfHeight);
+
},
/**
@@ -32403,13 +32632,15 @@ Phaser.Physics.Arcade.Body.prototype = {
this.angularVelocity = 0;
this.angularAcceleration = 0;
- this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
- this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
+ this.preX = (this.sprite.world.x - (this.sprite.anchor.x * this.width)) + this.offset.x;
+ this.preY = (this.sprite.world.y - (this.sprite.anchor.y * this.height)) + this.offset.y;
this.preRotation = this.sprite.angle;
this.x = this.preX;
this.y = this.preY;
this.rotation = this.preRotation;
+
+ this.center.setTo(this.x + this.halfWidth, this.y + this.halfHeight);
},
@@ -34305,10 +34536,13 @@ Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides
this._tw = (this.game.math.snapToCeil(width, tileWidth) + tileWidth) / tileWidth;
this._th = (this.game.math.snapToCeil(height, tileHeight) + tileHeight) / tileHeight;
- this._results.length = 0;
+ // This should apply the layer x/y here
+
+ // this._results.length = 0;
+ this._results = [];
// pretty sure we don't use this any more?
- this._results.push( { x: x, y: y, width: width, height: height, tx: this._tx, ty: this._ty, tw: this._tw, th: this._th });
+ // this._results.push( { x: x, y: y, width: width, height: height, tx: this._tx, ty: this._ty, tw: this._tw, th: this._th });
var _index = 0;
var _tile = null;
diff --git a/build/phaser.min.js b/build/phaser.min.js
index 8f59b959..243e7e91 100644
--- a/build/phaser.min.js
+++ b/build/phaser.min.js
@@ -1,10 +1,10 @@
/*! Phaser v1.1.1 | (c) 2013 Photon Storm Ltd. */
!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.Phaser=b()}(this,function(){function b(a){return[(255&a>>16)/255,(255&a>>8)/255,(255&a)/255]}function c(){return d.Matrix="undefined"!=typeof Float32Array?Float32Array:Array,d.Matrix}function b(a){return[(255&a>>16)/255,(255&a>>8)/255,(255&a)/255]}var d=d||{},e=e||{VERSION:"1.1.1",GAMES:[],AUTO:0,CANVAS:1,WEBGL:2,SPRITE:0,BUTTON:1,BULLET:2,GRAPHICS:3,TEXT:4,TILESPRITE:5,BITMAPTEXT:6,GROUP:7,RENDERTEXTURE:8,TILEMAP:9,TILEMAPLAYER:10,EMITTER:11,NONE:0,LEFT:1,RIGHT:2,UP:3,DOWN:4};return d.InteractionManager=function(){},e.Utils={shuffle:function(a){for(var b=a.length-1;b>0;b--){var c=Math.floor(Math.random()*(b+1)),d=a[b];a[b]=a[c],a[c]=d}return a},pad:function(a,b,c,d){if("undefined"==typeof b)var b=0;if("undefined"==typeof c)var c=" ";if("undefined"==typeof d)var d=3;if(b+1>=a.length)switch(d){case 1:a=Array(b+1-a.length).join(c)+a;break;case 3:var e=Math.ceil((padlen=b-a.length)/2),f=padlen-e;a=Array(f+1).join(c)+a+Array(e+1).join(c);break;default:a+=Array(b+1-a.length).join(c)}return a},isPlainObject:function(a){if("object"!=typeof a||a.nodeType||a===a.window)return!1;try{if(a.constructor&&!hasOwn.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}return!0},extend:function(){var a,b,c,d,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[1]||{},i=2),j===i&&(h=this,--i);j>i;i++)if(null!=(a=arguments[i]))for(b in a)c=h[b],d=a[b],h!==d&&(k&&d&&(e.Utils.isPlainObject(d)||(f=Array.isArray(d)))?(f?(f=!1,g=c&&Array.isArray(c)?c:[]):g=c&&e.Utils.isPlainObject(c)?c:{},h[b]=e.Utils.extend(k,g,d)):void 0!==d&&(h[b]=d));return h}},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){var a=Array.prototype.slice;return function(b){function c(){var f=e.concat(a.call(arguments));d.apply(this instanceof c?this:b,f)}var d=this,e=a.call(arguments,1);if("function"!=typeof d)throw new TypeError;return c.prototype=function f(a){return a&&(f.prototype=a),this instanceof f?void 0:new f}(d.prototype),c}}()),c(),d.mat3={},d.mat3.create=function(){var a=new d.Matrix(9);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},d.mat3.identity=function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},d.mat4={},d.mat4.create=function(){var a=new d.Matrix(16);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},d.mat3.multiply=function(a,b,c){c||(c=a);var d=a[0],e=a[1],f=a[2],g=a[3],h=a[4],i=a[5],j=a[6],k=a[7],l=a[8],m=b[0],n=b[1],o=b[2],p=b[3],q=b[4],r=b[5],s=b[6],t=b[7],u=b[8];return c[0]=m*d+n*g+o*j,c[1]=m*e+n*h+o*k,c[2]=m*f+n*i+o*l,c[3]=p*d+q*g+r*j,c[4]=p*e+q*h+r*k,c[5]=p*f+q*i+r*l,c[6]=s*d+t*g+u*j,c[7]=s*e+t*h+u*k,c[8]=s*f+t*i+u*l,c},d.mat3.clone=function(a){var b=new d.Matrix(9);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b},d.mat3.transpose=function(a,b){if(!b||a===b){var c=a[1],d=a[2],e=a[5];return a[1]=a[3],a[2]=a[6],a[3]=c,a[5]=a[7],a[6]=d,a[7]=e,a}return b[0]=a[0],b[1]=a[3],b[2]=a[6],b[3]=a[1],b[4]=a[4],b[5]=a[7],b[6]=a[2],b[7]=a[5],b[8]=a[8],b},d.mat3.toMat4=function(a,b){return b||(b=d.mat4.create()),b[15]=1,b[14]=0,b[13]=0,b[12]=0,b[11]=0,b[10]=a[8],b[9]=a[7],b[8]=a[6],b[7]=0,b[6]=a[5],b[5]=a[4],b[4]=a[3],b[3]=0,b[2]=a[2],b[1]=a[1],b[0]=a[0],b},d.mat4.create=function(){var a=new d.Matrix(16);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},d.mat4.transpose=function(a,b){if(!b||a===b){var c=a[1],d=a[2],e=a[3],f=a[6],g=a[7],h=a[11];return a[1]=a[4],a[2]=a[8],a[3]=a[12],a[4]=c,a[6]=a[9],a[7]=a[13],a[8]=d,a[9]=f,a[11]=a[14],a[12]=e,a[13]=g,a[14]=h,a}return b[0]=a[0],b[1]=a[4],b[2]=a[8],b[3]=a[12],b[4]=a[1],b[5]=a[5],b[6]=a[9],b[7]=a[13],b[8]=a[2],b[9]=a[6],b[10]=a[10],b[11]=a[14],b[12]=a[3],b[13]=a[7],b[14]=a[11],b[15]=a[15],b},d.mat4.multiply=function(a,b,c){c||(c=a);var d=a[0],e=a[1],f=a[2],g=a[3],h=a[4],i=a[5],j=a[6],k=a[7],l=a[8],m=a[9],n=a[10],o=a[11],p=a[12],q=a[13],r=a[14],s=a[15],t=b[0],u=b[1],v=b[2],w=b[3];return c[0]=t*d+u*h+v*l+w*p,c[1]=t*e+u*i+v*m+w*q,c[2]=t*f+u*j+v*n+w*r,c[3]=t*g+u*k+v*o+w*s,t=b[4],u=b[5],v=b[6],w=b[7],c[4]=t*d+u*h+v*l+w*p,c[5]=t*e+u*i+v*m+w*q,c[6]=t*f+u*j+v*n+w*r,c[7]=t*g+u*k+v*o+w*s,t=b[8],u=b[9],v=b[10],w=b[11],c[8]=t*d+u*h+v*l+w*p,c[9]=t*e+u*i+v*m+w*q,c[10]=t*f+u*j+v*n+w*r,c[11]=t*g+u*k+v*o+w*s,t=b[12],u=b[13],v=b[14],w=b[15],c[12]=t*d+u*h+v*l+w*p,c[13]=t*e+u*i+v*m+w*q,c[14]=t*f+u*j+v*n+w*r,c[15]=t*g+u*k+v*o+w*s,c},d.Point=function(a,b){this.x=a||0,this.y=b||0},d.Point.prototype.clone=function(){return new d.Point(this.x,this.y)},d.Point.prototype.constructor=d.Point,d.Rectangle=function(a,b,c,d){this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0},d.Rectangle.prototype.clone=function(){return new d.Rectangle(this.x,this.y,this.width,this.height)},d.Rectangle.prototype.contains=function(a,b){if(this.width<=0||this.height<=0)return!1;var c=this.x;if(a>=c&&a<=c+this.width){var d=this.y;if(b>=d&&b<=d+this.height)return!0}return!1},d.Rectangle.prototype.constructor=d.Rectangle,d.DisplayObject=function(){this.last=this,this.first=this,this.position=new d.Point,this.scale=new d.Point(1,1),this.pivot=new d.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.worldTransform=d.mat3.create(),this.localTransform=d.mat3.create(),this.color=[],this.dynamic=!0,this._sr=0,this._cr=1},d.DisplayObject.prototype.constructor=d.DisplayObject,d.DisplayObject.prototype.setInteractive=function(a){this.interactive=a},Object.defineProperty(d.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(a){this._interactive=a,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(d.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(a){this._mask=a,a?this.addFilter(a):this.removeFilter()}}),d.DisplayObject.prototype.addFilter=function(a){if(!this.filter){this.filter=!0;var b=new d.FilterBlock,c=new d.FilterBlock;b.mask=a,c.mask=a,b.first=b.last=this,c.first=c.last=this,b.open=!0;var e,f,g=b,h=b;f=this.first._iPrev,f?(e=f._iNext,g._iPrev=f,f._iNext=g):e=this,e&&(e._iPrev=h,h._iNext=e);var g=c,h=c,e=null,f=null;f=this.last,e=f._iNext,e&&(e._iPrev=h,h._iNext=e),g._iPrev=f,f._iNext=g;for(var i=this,j=this.last;i;)i.last==j&&(i.last=c),i=i.parent;this.first=b,this.__renderGroup&&this.__renderGroup.addFilterBlocks(b,c),a.renderable=!1}},d.DisplayObject.prototype.removeFilter=function(){if(this.filter){this.filter=!1;var a=this.first,b=a._iNext,c=a._iPrev;b&&(b._iPrev=c),c&&(c._iNext=b),this.first=a._iNext;var d=this.last,b=d._iNext,c=d._iPrev;b&&(b._iPrev=c),c._iNext=b;for(var e=d._iPrev,f=this;f.last==d&&(f.last=e,f=f.parent););var g=a.mask;g.renderable=!0,this.__renderGroup&&this.__renderGroup.removeFilterBlocks(a,d)}},d.DisplayObject.prototype.updateTransform=function(){this.rotation!==this.rotationCache&&(this.rotationCache=this.rotation,this._sr=Math.sin(this.rotation),this._cr=Math.cos(this.rotation));var a=this.localTransform,b=this.parent.worldTransform,c=this.worldTransform;a[0]=this._cr*this.scale.x,a[1]=-this._sr*this.scale.y,a[3]=this._sr*this.scale.x,a[4]=this._cr*this.scale.y;var e=this.pivot.x,f=this.pivot.y,g=a[0],h=a[1],i=this.position.x-a[0]*e-f*a[1],j=a[3],k=a[4],l=this.position.y-a[4]*f-e*a[3],m=b[0],n=b[1],o=b[2],p=b[3],q=b[4],r=b[5];a[2]=i,a[5]=l,c[0]=m*g+n*j,c[1]=m*h+n*k,c[2]=m*i+n*l+o,c[3]=p*g+q*j,c[4]=p*h+q*k,c[5]=p*i+q*l+r,this.worldAlpha=this.alpha*this.parent.worldAlpha,this.vcount=d.visibleCount},d.visibleCount=0,d.DisplayObjectContainer=function(){d.DisplayObject.call(this),this.children=[]},d.DisplayObjectContainer.prototype=Object.create(d.DisplayObject.prototype),d.DisplayObjectContainer.prototype.constructor=d.DisplayObjectContainer,d.DisplayObjectContainer.prototype.addChild=function(a){if(void 0!=a.parent&&a.parent.removeChild(a),a.parent=this,this.children.push(a),this.stage){var b=a;do b.interactive&&(this.stage.dirty=!0),b.stage=this.stage,b=b._iNext;while(b)}var c,d,e=a.first,f=a.last;d=this.filter?this.last._iPrev:this.last,c=d._iNext;for(var g=this,h=d;g;)g.last==h&&(g.last=a.last),g=g.parent;c&&(c._iPrev=f,f._iNext=c),e._iPrev=d,d._iNext=e,this.__renderGroup&&(a.__renderGroup&&a.__renderGroup.removeDisplayObjectAndChildren(a),this.__renderGroup.addDisplayObjectAndChildren(a))},d.DisplayObjectContainer.prototype.addChildAt=function(a,b){if(!(b>=0&&b<=this.children.length))throw new Error(a+" The index "+b+" supplied is out of bounds "+this.children.length);if(void 0!=a.parent&&a.parent.removeChild(a),a.parent=this,this.stage){var c=a;do c.interactive&&(this.stage.dirty=!0),c.stage=this.stage,c=c._iNext;while(c)}var d,e,f=a.first,g=a.last;if(b==this.children.length){e=this.last;for(var h=this,i=this.last;h;)h.last==i&&(h.last=a.last),h=h.parent}else e=0==b?this:this.children[b-1].last;d=e._iNext,d&&(d._iPrev=g,g._iNext=d),f._iPrev=e,e._iNext=f,this.children.splice(b,0,a),this.__renderGroup&&(a.__renderGroup&&a.__renderGroup.removeDisplayObjectAndChildren(a),this.__renderGroup.addDisplayObjectAndChildren(a))},d.DisplayObjectContainer.prototype.swapChildren=function(){},d.DisplayObjectContainer.prototype.getChildAt=function(a){if(a>=0&&a