Active animations now monitor if the game pauses, and resume normally when the game un-pauses (fixes #179)

This commit is contained in:
photonstorm
2014-02-24 23:06:45 +00:00
parent 36df5516dd
commit beaac18b8f
4 changed files with 60 additions and 6 deletions
+20 -5
View File
@@ -1,5 +1,5 @@
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload() {
@@ -7,15 +7,30 @@ function preload() {
}
var mummy;
var anim;
function create() {
// game.stage.backgroundColor = '#239923';
game.stage.backgroundColor = 0xff8855;
var mummy = game.add.sprite(300, 200, 'mummy', 5);
mummy = game.add.sprite(300, 200, 'mummy', 5);
mummy.animations.add('walk');
mummy.animations.updateIfVisible = false;
mummy.animations.play('walk', 20, true);
anim = mummy.animations.add('walk');
anim.play(2, false);
// anim.play(2, true);
}
function update() {
}
function render() {
game.debug.renderText(anim.frame + ' / 17', 32, 32);
}