|
9 | 9 | * |
10 | 10 | * Phaser - http://www.phaser.io |
11 | 11 | * |
12 | | -* v1.0.7 - Built at: Thu, 17 Oct 2013 22:56:02 +0100 |
| 12 | +* v1.0.7 - Built at: Fri, 18 Oct 2013 01:36:29 +0100 |
13 | 13 | * |
14 | 14 | * By Richard Davey http://www.photonstorm.com @photonstorm |
15 | 15 | * |
@@ -10948,8 +10948,9 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant |
10948 | 10948 | renderer = renderer || Phaser.AUTO; |
10949 | 10949 | parent = parent || ''; |
10950 | 10950 | state = state || null; |
| 10951 | + |
10951 | 10952 | if (typeof transparent == 'undefined') { transparent = false; } |
10952 | | - if (typeof antialias == 'undefined') { antialias = false; } |
| 10953 | + if (typeof antialias == 'undefined') { antialias = true; } |
10953 | 10954 |
|
10954 | 10955 | /** |
10955 | 10956 | * @property {number} id - Phaser Game ID (for when Pixi supports multiple instances). |
@@ -16644,7 +16645,19 @@ Object.defineProperty(Phaser.Sprite.prototype, "crop", { |
16644 | 16645 | this._cropRect = value; |
16645 | 16646 | this.setTexture(PIXI.TextureCache[this._cropUUID]); |
16646 | 16647 | } |
| 16648 | + else |
| 16649 | + { |
| 16650 | + this._cropRect = null; |
16647 | 16651 |
|
| 16652 | + if (this.animations.isLoaded) |
| 16653 | + { |
| 16654 | + this.animations.refreshFrame(); |
| 16655 | + } |
| 16656 | + else |
| 16657 | + { |
| 16658 | + this.setTexture(PIXI.TextureCache[this.key]); |
| 16659 | + } |
| 16660 | + } |
16648 | 16661 | } |
16649 | 16662 |
|
16650 | 16663 | }); |
@@ -17705,6 +17718,7 @@ Phaser.Canvas = { |
17705 | 17718 | * @return {HTMLCanvasElement} The newly created <canvas> tag. |
17706 | 17719 | */ |
17707 | 17720 | create: function (width, height) { |
| 17721 | + |
17708 | 17722 | width = width || 256; |
17709 | 17723 | height = height || 256; |
17710 | 17724 |
|
@@ -24248,6 +24262,12 @@ Phaser.AnimationManager = function (sprite) { |
24248 | 24262 | */ |
24249 | 24263 | this.updateIfVisible = true; |
24250 | 24264 |
|
| 24265 | + /** |
| 24266 | + * @property {boolean} isLoaded - Set to true once animation data has been loaded. |
| 24267 | + * @default |
| 24268 | + */ |
| 24269 | + this.isLoaded = false; |
| 24270 | + |
24251 | 24271 | /** |
24252 | 24272 | * @property {Phaser.FrameData} _frameData - A temp. var for holding the currently playing Animations FrameData. |
24253 | 24273 | * @private |
@@ -24283,6 +24303,7 @@ Phaser.AnimationManager.prototype = { |
24283 | 24303 |
|
24284 | 24304 | this._frameData = frameData; |
24285 | 24305 | this.frame = 0; |
| 24306 | + this.isLoaded = true; |
24286 | 24307 |
|
24287 | 24308 | }, |
24288 | 24309 |
|
@@ -24464,6 +24485,18 @@ Phaser.AnimationManager.prototype = { |
24464 | 24485 |
|
24465 | 24486 | }, |
24466 | 24487 |
|
| 24488 | + /** |
| 24489 | + * Refreshes the current frame data back to the parent Sprite and also resets the texture data. |
| 24490 | + * |
| 24491 | + * @method Phaser.AnimationManager#refreshFrame |
| 24492 | + */ |
| 24493 | + refreshFrame: function () { |
| 24494 | + |
| 24495 | + this.sprite.currentFrame = this.currentFrame; |
| 24496 | + this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); |
| 24497 | + |
| 24498 | + }, |
| 24499 | + |
24467 | 24500 | /** |
24468 | 24501 | * Destroys all references this AnimationManager contains. Sets the _anims to a new object and nulls the current animation. |
24469 | 24502 | * |
@@ -24552,7 +24585,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frame", { |
24552 | 24585 |
|
24553 | 24586 | set: function (value) { |
24554 | 24587 |
|
24555 | | - if (this._frameData && this._frameData.getFrame(value) !== null) |
| 24588 | + if (typeof value === 'number' && this._frameData && this._frameData.getFrame(value) !== null) |
24556 | 24589 | { |
24557 | 24590 | this.currentFrame = this._frameData.getFrame(value); |
24558 | 24591 | this._frameIndex = value; |
@@ -24581,7 +24614,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frameName", { |
24581 | 24614 |
|
24582 | 24615 | set: function (value) { |
24583 | 24616 |
|
24584 | | - if (this._frameData && this._frameData.getFrameByName(value) !== null) |
| 24617 | + if (typeof value === 'string' && this._frameData && this._frameData.getFrameByName(value) !== null) |
24585 | 24618 | { |
24586 | 24619 | this.currentFrame = this._frameData.getFrameByName(value); |
24587 | 24620 | this._frameIndex = this.currentFrame.index; |
@@ -31491,8 +31524,12 @@ Phaser.Physics.Arcade.Body.prototype = { |
31491 | 31524 |
|
31492 | 31525 | this.screenX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; |
31493 | 31526 | this.screenY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; |
31494 | | - this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; |
31495 | | - this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; |
| 31527 | + |
| 31528 | + // this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; |
| 31529 | + // this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; |
| 31530 | + this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; |
| 31531 | + this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; |
| 31532 | + |
31496 | 31533 | this.preRotation = this.sprite.angle; |
31497 | 31534 |
|
31498 | 31535 | this.x = this.preX; |
@@ -31616,10 +31653,10 @@ Phaser.Physics.Arcade.Body.prototype = { |
31616 | 31653 | this.angularVelocity = 0; |
31617 | 31654 | this.angularAcceleration = 0; |
31618 | 31655 |
|
31619 | | - // this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; |
31620 | | - // this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; |
31621 | | - this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; |
31622 | | - this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; |
| 31656 | + this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; |
| 31657 | + this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; |
| 31658 | + // this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x; |
| 31659 | + // this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y; |
31623 | 31660 | this.preRotation = this.sprite.angle; |
31624 | 31661 |
|
31625 | 31662 | this.x = this.preX; |
|
0 commit comments