mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
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:
@@ -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() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user