mirror of
https://github.com/photonstorm/phaser
synced 2024-11-21 20:23:19 +00:00
Fixed Game.boot issue and Animation issue reported in github.
This commit is contained in:
parent
268470ef62
commit
1b6fbc1324
7 changed files with 76 additions and 15 deletions
|
@ -70,6 +70,7 @@ module Phaser {
|
|||
this._anims[name] = new Animation(this._game, this._parent, this._frameData, name, frames, frameRate, loop);
|
||||
|
||||
this.currentAnim = this._anims[name];
|
||||
this.currentFrame = this.currentAnim.currentFrame;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
/**
|
||||
* Phaser - Game
|
||||
*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
module Phaser {
|
||||
|
@ -51,11 +51,12 @@ module Phaser {
|
|||
|
||||
if (document.readyState === 'complete' || document.readyState === 'interactive')
|
||||
{
|
||||
this.boot(parent, width, height);
|
||||
setTimeout((parent, width, height) => this.boot(parent, width, height));
|
||||
}
|
||||
else
|
||||
{
|
||||
document.addEventListener('DOMContentLoaded', () => this.boot(parent, width, height), false);
|
||||
window.addEventListener('load', () => this.boot(parent, width, height), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -95,6 +96,11 @@ module Phaser {
|
|||
|
||||
private boot(parent: string, width: number, height: number) {
|
||||
|
||||
if (this.isBooted == true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!document.body)
|
||||
{
|
||||
window.setTimeout(() => this.boot(parent, width, height), 13);
|
||||
|
|
|
@ -24,6 +24,9 @@ module Phaser {
|
|||
this.isFinished = false;
|
||||
this.isPlaying = false;
|
||||
|
||||
this._frameIndex = 0;
|
||||
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
|
||||
|
||||
}
|
||||
|
||||
private _game: Game;
|
||||
|
|
|
@ -30,12 +30,26 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public addKeyCapture(keycode: number) {
|
||||
this._capture[keycode] = true;
|
||||
public addKeyCapture(keycode) {
|
||||
|
||||
if (typeof keycode == 'array')
|
||||
{
|
||||
for (var code in keycode)
|
||||
{
|
||||
this._capture[code] = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._capture[keycode] = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public removeKeyCapture(keycode: number) {
|
||||
|
||||
delete this._capture[keycode];
|
||||
|
||||
}
|
||||
|
||||
public clearCaptures() {
|
||||
|
|
|
@ -3,7 +3,7 @@ Phaser
|
|||
|
||||
Version 0.9.3
|
||||
|
||||
23rd April 2013
|
||||
24th April 2013
|
||||
|
||||
By Richard Davey, [Photon Storm](http://www.photonstorm.com)
|
||||
|
||||
|
@ -27,7 +27,10 @@ V0.9.3
|
|||
* Added shiftSinTable and shiftCosTable to the GameMath class to allow for quick iteration through the data tables.
|
||||
* Added the new ScrollZone game object. Endlessly useful but especially for scrolling backdrops. Created 6 example tests.
|
||||
* Removed the need for DynamicTextures to require a key property and updated test cases.
|
||||
* Add the rotationOffset value to GameObject (and thus Sprite). Useful if your graphics need to rotate but don't weren't drawn facing zero degrees (to the right).
|
||||
* Add the rotationOffset value to GameObject (and thus Sprite). Useful if your graphics need to rotate but weren't drawn facing zero degrees (to the right).
|
||||
* You can now pass an array or a single value to Input.Keyboard.addKeyCapture()
|
||||
* Fixed a potential race condition issue in Game.boot (thanks Hackmaniac)
|
||||
* Fixed issue with showing frame zero of a texture atlas before the animation started playing (thanks JesseFreeman)
|
||||
|
||||
V0.9.2
|
||||
|
||||
|
|
|
@ -1666,6 +1666,8 @@ var Phaser;
|
|||
this.looped = looped;
|
||||
this.isFinished = false;
|
||||
this.isPlaying = false;
|
||||
this._frameIndex = 0;
|
||||
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
|
||||
}
|
||||
Object.defineProperty(Animation.prototype, "frameTotal", {
|
||||
get: function () {
|
||||
|
@ -1982,6 +1984,7 @@ var Phaser;
|
|||
}
|
||||
this._anims[name] = new Phaser.Animation(this._game, this._parent, this._frameData, name, frames, frameRate, loop);
|
||||
this.currentAnim = this._anims[name];
|
||||
this.currentFrame = this.currentAnim.currentFrame;
|
||||
};
|
||||
AnimationManager.prototype.validateFrames = function (frames, useNumericIndex) {
|
||||
for(var i = 0; i < frames.length; i++) {
|
||||
|
@ -9477,7 +9480,13 @@ var Phaser;
|
|||
}, false);
|
||||
};
|
||||
Keyboard.prototype.addKeyCapture = function (keycode) {
|
||||
this._capture[keycode] = true;
|
||||
if(typeof keycode == 'array') {
|
||||
for(var code in keycode) {
|
||||
this._capture[code] = true;
|
||||
}
|
||||
} else {
|
||||
this._capture[keycode] = true;
|
||||
}
|
||||
};
|
||||
Keyboard.prototype.removeKeyCapture = function (keycode) {
|
||||
delete this._capture[keycode];
|
||||
|
@ -11217,8 +11226,8 @@ var Phaser;
|
|||
/**
|
||||
* Phaser - Game
|
||||
*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
var Phaser;
|
||||
(function (Phaser) {
|
||||
|
@ -11250,15 +11259,23 @@ var Phaser;
|
|||
this.onUpdateCallback = updateCallback;
|
||||
this.onRenderCallback = renderCallback;
|
||||
if(document.readyState === 'complete' || document.readyState === 'interactive') {
|
||||
this.boot(parent, width, height);
|
||||
setTimeout(function (parent, width, height) {
|
||||
return _this.boot(parent, width, height);
|
||||
});
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
return _this.boot(parent, width, height);
|
||||
}, false);
|
||||
window.addEventListener('load', function () {
|
||||
return _this.boot(parent, width, height);
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
Game.prototype.boot = function (parent, width, height) {
|
||||
var _this = this;
|
||||
if(this.isBooted == true) {
|
||||
return;
|
||||
}
|
||||
if(!document.body) {
|
||||
window.setTimeout(function () {
|
||||
return _this.boot(parent, width, height);
|
||||
|
|
|
@ -1666,6 +1666,8 @@ var Phaser;
|
|||
this.looped = looped;
|
||||
this.isFinished = false;
|
||||
this.isPlaying = false;
|
||||
this._frameIndex = 0;
|
||||
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
|
||||
}
|
||||
Object.defineProperty(Animation.prototype, "frameTotal", {
|
||||
get: function () {
|
||||
|
@ -1982,6 +1984,7 @@ var Phaser;
|
|||
}
|
||||
this._anims[name] = new Phaser.Animation(this._game, this._parent, this._frameData, name, frames, frameRate, loop);
|
||||
this.currentAnim = this._anims[name];
|
||||
this.currentFrame = this.currentAnim.currentFrame;
|
||||
};
|
||||
AnimationManager.prototype.validateFrames = function (frames, useNumericIndex) {
|
||||
for(var i = 0; i < frames.length; i++) {
|
||||
|
@ -9477,7 +9480,13 @@ var Phaser;
|
|||
}, false);
|
||||
};
|
||||
Keyboard.prototype.addKeyCapture = function (keycode) {
|
||||
this._capture[keycode] = true;
|
||||
if(typeof keycode == 'array') {
|
||||
for(var code in keycode) {
|
||||
this._capture[code] = true;
|
||||
}
|
||||
} else {
|
||||
this._capture[keycode] = true;
|
||||
}
|
||||
};
|
||||
Keyboard.prototype.removeKeyCapture = function (keycode) {
|
||||
delete this._capture[keycode];
|
||||
|
@ -11217,8 +11226,8 @@ var Phaser;
|
|||
/**
|
||||
* Phaser - Game
|
||||
*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
var Phaser;
|
||||
(function (Phaser) {
|
||||
|
@ -11250,15 +11259,23 @@ var Phaser;
|
|||
this.onUpdateCallback = updateCallback;
|
||||
this.onRenderCallback = renderCallback;
|
||||
if(document.readyState === 'complete' || document.readyState === 'interactive') {
|
||||
this.boot(parent, width, height);
|
||||
setTimeout(function (parent, width, height) {
|
||||
return _this.boot(parent, width, height);
|
||||
});
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
return _this.boot(parent, width, height);
|
||||
}, false);
|
||||
window.addEventListener('load', function () {
|
||||
return _this.boot(parent, width, height);
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
Game.prototype.boot = function (parent, width, height) {
|
||||
var _this = this;
|
||||
if(this.isBooted == true) {
|
||||
return;
|
||||
}
|
||||
if(!document.body) {
|
||||
window.setTimeout(function () {
|
||||
return _this.boot(parent, width, height);
|
||||
|
|
Loading…
Reference in a new issue