99*
1010* Phaser - http://www.phaser.io
1111*
12- * v1.0.7 - Built at: Wed, 09 Oct 2013 17: 16:16 +0100
12+ * v1.0.7 - Built at: Thu, 10 Oct 2013 16:51:46 +0100
1313*
1414* By Richard Davey http://www.photonstorm.com @photonstorm
1515*
@@ -7340,10 +7340,21 @@ Phaser.Camera.prototype = {
73407340 break;
73417341 }
73427342
7343+ },
7344+
7345+ /**
7346+ * Move the camera focus on a display object instantly.
7347+ * @method Phaser.Camera#focusOn
7348+ * @param {any} displayObject - The display object to focus the camera on. Must have visible x/y properties.
7349+ */
7350+ focusOn: function (displayObject) {
7351+
7352+ this.setPosition(Math.round(displayObject.x - this.view.halfWidth), Math.round(displayObject.y - this.view.halfHeight));
7353+
73437354 },
73447355
73457356 /**
7346- * Move the camera focus to a location instantly.
7357+ * Move the camera focus on a location instantly.
73477358 * @method Phaser.Camera#focusOnXY
73487359 * @param {number} x - X position.
73497360 * @param {number} y - Y position.
@@ -16007,6 +16018,7 @@ Phaser.Sprite.prototype.preUpdate = function() {
1600716018 this.prevY = this.y;
1600816019
1600916020 this.updateCache();
16021+ this.updateAnimation();
1601016022
1601116023 // Re-run the camera visibility check
1601216024 if (this._cache.dirty)
@@ -16065,7 +16077,10 @@ Phaser.Sprite.prototype.updateCache = function() {
1606516077 this._cache.dirty = true;
1606616078 }
1606716079
16068- // Frame updated?
16080+ }
16081+
16082+ Phaser.Sprite.prototype.updateAnimation = function() {
16083+
1606916084 if (this.currentFrame && this.currentFrame.uuid != this._cache.frameID)
1607016085 {
1607116086 this._cache.frameWidth = this.texture.frame.width;
@@ -16119,6 +16134,47 @@ Phaser.Sprite.prototype.postUpdate = function() {
1611916134
1612016135}
1612116136
16137+ Phaser.Sprite.prototype.loadTexture = function (key, frame) {
16138+
16139+ this.key = key;
16140+
16141+ if (key instanceof Phaser.RenderTexture)
16142+ {
16143+ this.currentFrame = this.game.cache.getTextureFrame(key.name);
16144+ }
16145+ else
16146+ {
16147+ if (key == null || this.game.cache.checkImageKey(key) == false)
16148+ {
16149+ key = '__default';
16150+ }
16151+
16152+ if (this.game.cache.isSpriteSheet(key))
16153+ {
16154+ this.animations.loadFrameData(this.game.cache.getFrameData(key));
16155+
16156+ if (frame !== null)
16157+ {
16158+ if (typeof frame === 'string')
16159+ {
16160+ this.frameName = frame;
16161+ }
16162+ else
16163+ {
16164+ this.frame = frame;
16165+ }
16166+ }
16167+ }
16168+ else
16169+ {
16170+ this.currentFrame = this.game.cache.getFrame(key);
16171+ }
16172+ }
16173+
16174+ this.updateAnimation();
16175+
16176+ }
16177+
1612216178Phaser.Sprite.prototype.deltaAbsX = function () {
1612316179 return (this.deltaX() > 0 ? this.deltaX() : -this.deltaX());
1612416180}
@@ -16430,6 +16486,18 @@ Object.defineProperty(Phaser.Sprite.prototype, "inCamera", {
1643016486
1643116487});
1643216488
16489+ /**
16490+ *
16491+ * @returns {boolean}
16492+ */
16493+ Object.defineProperty(Phaser.Sprite.prototype, "worldX", {
16494+
16495+ get: function () {
16496+ return 1;
16497+ }
16498+
16499+ });
16500+
1643316501/**
1643416502* Get the input enabled state of this Sprite.
1643516503* @returns {Description}
@@ -22959,6 +23027,7 @@ Phaser.Tween.prototype = {
2295923027 */
2296023028 pause: function () {
2296123029 this._paused = true;
23030+ this._pausedTime = this.game.time.now;
2296223031 },
2296323032
2296423033 /**
@@ -22968,7 +23037,7 @@ Phaser.Tween.prototype = {
2296823037 */
2296923038 resume: function () {
2297023039 this._paused = false;
22971- this._startTime += this.game.time.pauseDuration ;
23040+ this._startTime += ( this.game.time.now - this._pausedTime) ;
2297223041 },
2297323042
2297423043 /**
@@ -29081,6 +29150,7 @@ Phaser.Utils.Debug.prototype = {
2908129150 this.line('angle: ' + sprite.angle.toFixed(1) + ' rotation: ' + sprite.rotation.toFixed(1));
2908229151 this.line('visible: ' + sprite.visible + ' in camera: ' + sprite.inCamera);
2908329152 this.line('body x: ' + sprite.body.x.toFixed(1) + ' y: ' + sprite.body.y.toFixed(1));
29153+ this.stop();
2908429154
2908529155 // 0 = scaleX
2908629156 // 1 = skewY
@@ -29131,6 +29201,7 @@ Phaser.Utils.Debug.prototype = {
2913129201 this.line('scaleY: ' + sprite.worldTransform[4]);
2913229202 this.line('transX: ' + sprite.worldTransform[2]);
2913329203 this.line('transY: ' + sprite.worldTransform[5]);
29204+ this.stop();
2913429205
2913529206 },
2913629207
@@ -29160,6 +29231,49 @@ Phaser.Utils.Debug.prototype = {
2916029231 this.line('scaleY: ' + sprite.localTransform[4]);
2916129232 this.line('transX: ' + sprite.localTransform[2]);
2916229233 this.line('transY: ' + sprite.localTransform[5]);
29234+ this.stop();
29235+
29236+ },
29237+
29238+ renderSpriteCoords: function (sprite, x, y, color) {
29239+
29240+ if (this.context == null)
29241+ {
29242+ return;
29243+ }
29244+
29245+ color = color || 'rgb(255, 255, 255)';
29246+
29247+ this.start(x, y, color);
29248+
29249+ this.line(sprite.name);
29250+ this.line('x: ' + sprite.x);
29251+ this.line('y: ' + sprite.y);
29252+ this.line('local x: ' + sprite.localTransform[2]);
29253+ this.line('local y: ' + sprite.localTransform[5]);
29254+ this.line('world x: ' + sprite.worldTransform[2]);
29255+ this.line('world y: ' + sprite.worldTransform[5]);
29256+
29257+ this.stop();
29258+
29259+ },
29260+
29261+ renderGroupInfo: function (group, x, y, color) {
29262+
29263+ if (this.context == null)
29264+ {
29265+ return;
29266+ }
29267+
29268+ color = color || 'rgb(255, 255, 255)';
29269+
29270+ this.start(x, y, color);
29271+
29272+ this.line('Group (size: ' + group.length + ')');
29273+ this.line('x: ' + group.x);
29274+ this.line('y: ' + group.y);
29275+
29276+ this.stop();
2916329277
2916429278 },
2916529279
0 commit comments