Tweens now resume correctly if the game pauses (focus loss) while they are paused.

Tweens don't double pause if they were already paused and the game pauses.
This commit is contained in:
photonstorm
2014-02-26 23:27:22 +00:00
parent 86374d4437
commit 4d284029c7
6 changed files with 114 additions and 20 deletions
+19 -4
View File
@@ -23,21 +23,36 @@ function create() {
anim.play(10, true);
game.onPause.add(paused, this);
game.onResume.add(resumed, this);
// game.onPause.add(paused, this);
// game.onResume.add(resumed, this);
t = game.add.tween(mummy).to({x:700}, 15000, Phaser.Easing.Linear.None, true);
t.onComplete.add(tweenOver, this);
s.push('starting: ' + game.stage._hiddenVar);
game.input.onDown.add(pauseTween, this);
}
function pauseTween(pointer) {
if (pointer.x < 400)
{
t.pause();
}
else
{
t.resume();
}
}
function tweenOver() {
console.log('yay all over after 15 seconds anyway');
}
function pauseToggle() {
/*function pauseToggle() {
if (game.paused)
{
@@ -49,7 +64,6 @@ function pauseToggle() {
}
}
function paused() {
s.push('paused now: ' + game.time.now);
@@ -64,6 +78,7 @@ function resumed() {
s.push('pause duration: ' + game.time.pauseDuration);
}
*/
function update() {