mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
Fixed bug where a Tween with both yoyo and loop enabled would get out of sync.
This commit is contained in:
parent
ab7e55ef27
commit
48f6d850c8
11 changed files with 39 additions and 32 deletions
|
@ -685,7 +685,6 @@ module Phaser {
|
|||
{
|
||||
this._paused = true;
|
||||
this.onPause.dispatch();
|
||||
// Hook to the above
|
||||
this.sound.pauseAll();
|
||||
this._raf.callback = this.pausedLoop;
|
||||
}
|
||||
|
@ -693,7 +692,6 @@ module Phaser {
|
|||
{
|
||||
this._paused = false;
|
||||
this.onResume.dispatch();
|
||||
// Hook to the above
|
||||
this.input.reset();
|
||||
this.sound.resumeAll();
|
||||
|
||||
|
|
|
@ -406,7 +406,7 @@ module Phaser {
|
|||
// We've yoyo'd once already, quit?
|
||||
if (this._loop == false)
|
||||
{
|
||||
this.onComplete.dispatch(this._object);
|
||||
this.onComplete.dispatch(this._object);
|
||||
|
||||
for (var i = 0; i < this._chainedTweens.length; i++)
|
||||
{
|
||||
|
@ -415,6 +415,13 @@ module Phaser {
|
|||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// YoYo and Loop are both on
|
||||
this._yoyoCount = 0;
|
||||
this.reverse();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
10
README.md
10
README.md
|
@ -28,21 +28,19 @@ Future Plans
|
|||
* Ability to layer another DOM object and have it controlled by the game somehow. Can then do stacked canvas effects.
|
||||
* Add ability to create extra <div>s within the game container, layered above/below the canvas
|
||||
* Basic Window UI component (maybe a propogating Group?)
|
||||
* Add clip support + shape options to Texture Component.
|
||||
|
||||
ToDo before release
|
||||
-------------------
|
||||
|
||||
* Hook sound/input to the pause/resume signals
|
||||
* Fix bug in Tween yoyo + loop combo
|
||||
* Allow camera to directly render to the stage rather than hidden ctx (maybe does this by default? or have under Mobile Optimisations list)
|
||||
* Tilemap.render - move layers length to var
|
||||
* Tilemap.destroy needs doing
|
||||
* Investigate bug re: tilemap collision and animation frames
|
||||
* Add clip support + shape options to Texture Component.
|
||||
* Need to be able to set the current tilemap layer, then the getTileXY default layer uses that one if no other given
|
||||
* Allow camera to directly render to the stage rather than hidden ctx (maybe does this by default? or have under Mobile Optimisations list)
|
||||
* Sprite collision events
|
||||
* Check bounds/edge points when sprite is only 1x1 sized :)
|
||||
* QuadTree.physics.checkHullIntersection
|
||||
* Tilemap.render - move layers length to var
|
||||
* Tilemap.destroy needs doing
|
||||
* Sprite.transform.bottomRight/Left doesn't seem to take origin into account
|
||||
* Stage lost to mute
|
||||
* Bitmap Font support
|
||||
|
|
|
@ -10736,6 +10736,11 @@ var Phaser;
|
|||
this._chainedTweens[i].start();
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
// YoYo and Loop are both on
|
||||
this._yoyoCount = 0;
|
||||
this.reverse();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18834,13 +18839,11 @@ var Phaser;
|
|||
if(value == true && this._paused == false) {
|
||||
this._paused = true;
|
||||
this.onPause.dispatch();
|
||||
// Hook to the above
|
||||
this.sound.pauseAll();
|
||||
this._raf.callback = this.pausedLoop;
|
||||
} else if(value == false && this._paused == true) {
|
||||
this._paused = false;
|
||||
this.onResume.dispatch();
|
||||
// Hook to the above
|
||||
this.input.reset();
|
||||
this.sound.resumeAll();
|
||||
if(this.isRunning == false) {
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
bunny.transform.scale.setTo(0.5, 0.5);
|
||||
// This time let's scale the sprite by a looped tween
|
||||
game.add.tween(bunny.transform.scale).to({
|
||||
x: 2,
|
||||
y: 2
|
||||
x: 1.5,
|
||||
y: 1.5
|
||||
}, 2000, Phaser.Easing.Elastic.Out, true, 0, true, true);
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
bunny.transform.scale.setTo(0.5, 0.5);
|
||||
|
||||
// This time let's scale the sprite by a looped tween
|
||||
game.add.tween(bunny.transform.scale).to({ x: 2, y: 2 }, 2000, Phaser.Easing.Elastic.Out, true, 0, true, true);
|
||||
game.add.tween(bunny.transform.scale).to({ x: 1.5, y: 1.5 }, 2000, Phaser.Easing.Elastic.Out, true, 0, true, true);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
// Here we'll assign the new sprite to the local swirl variable
|
||||
swirl = game.add.sprite(game.stage.centerX, game.stage.centerY, 'swirl');
|
||||
// Increase the size of the sprite a little so it covers the edges of the stage
|
||||
swirl.transform.scale.setTo(1.4, 1.4);
|
||||
swirl.scale.setTo(1.4, 1.4);
|
||||
// Set the origin to the middle of the Sprite to get the effect we need
|
||||
swirl.transform.origin.setTo(swirl.worldView.halfWidth, swirl.worldView.halfHeight);
|
||||
// Create a tween that rotates a full 306 degrees and then repeats (loop set to true)
|
||||
swirl.origin.setTo(0.5, 0.5);
|
||||
// Create a tween that rotates a full 360 degrees and then repeats (loop set to true)
|
||||
game.add.tween(swirl).to({
|
||||
rotation: 360
|
||||
}, 2000, Phaser.Easing.Linear.None, true, 0, true);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
// Using Phasers asset loader we load up a PNG from the assets folder
|
||||
game.load.image('swirl', 'assets/pics/color_wheel_swirl.png');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -20,12 +19,12 @@
|
|||
swirl = game.add.sprite(game.stage.centerX, game.stage.centerY, 'swirl');
|
||||
|
||||
// Increase the size of the sprite a little so it covers the edges of the stage
|
||||
swirl.transform.scale.setTo(1.4, 1.4);
|
||||
swirl.scale.setTo(1.4, 1.4);
|
||||
|
||||
// Set the origin to the middle of the Sprite to get the effect we need
|
||||
swirl.transform.origin.setTo(swirl.worldView.halfWidth, swirl.worldView.halfHeight);
|
||||
swirl.origin.setTo(0.5, 0.5);
|
||||
|
||||
// Create a tween that rotates a full 306 degrees and then repeats (loop set to true)
|
||||
// Create a tween that rotates a full 360 degrees and then repeats (loop set to true)
|
||||
game.add.tween(swirl).to({ rotation: 360 }, 2000, Phaser.Easing.Linear.None, true, 0, true);
|
||||
|
||||
}
|
||||
|
|
|
@ -10,16 +10,16 @@
|
|||
// Here we'll assign the new sprite to the local swirl variable
|
||||
swirl = game.add.sprite(game.stage.centerX, game.stage.centerY, 'swirl');
|
||||
// Increase the size of the sprite a little so it covers the edges of the stage
|
||||
swirl.transform.scale.setTo(1.4, 1.4);
|
||||
swirl.scale.setTo(1.4, 1.4);
|
||||
// Set the origin to the middle of the Sprite to get the effect we need
|
||||
swirl.transform.origin.setTo(swirl.worldView.halfWidth, swirl.worldView.halfHeight);
|
||||
// Create a tween that rotates a full 306 degrees and then repeats (loop set to true)
|
||||
swirl.origin.setTo(0.5, 0.5);
|
||||
// Create a tween that rotates a full 360 degrees and then repeats (loop set to true)
|
||||
game.add.tween(swirl).to({
|
||||
rotation: 360
|
||||
}, 2000, Phaser.Easing.Linear.None, true, 0, true);
|
||||
game.add.tween(swirl.transform.scale).to({
|
||||
x: 4,
|
||||
y: 4
|
||||
}, 1000, Phaser.Easing.Linear.None, true, 0, true, true);
|
||||
}, 4000, Phaser.Easing.Linear.None, true, 0, true, true);
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
// Using Phasers asset loader we load up a PNG from the assets folder
|
||||
game.load.image('swirl', 'assets/pics/color_wheel_swirl.png');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -20,14 +19,14 @@
|
|||
swirl = game.add.sprite(game.stage.centerX, game.stage.centerY, 'swirl');
|
||||
|
||||
// Increase the size of the sprite a little so it covers the edges of the stage
|
||||
swirl.transform.scale.setTo(1.4, 1.4);
|
||||
swirl.scale.setTo(1.4, 1.4);
|
||||
|
||||
// Set the origin to the middle of the Sprite to get the effect we need
|
||||
swirl.transform.origin.setTo(swirl.worldView.halfWidth, swirl.worldView.halfHeight);
|
||||
swirl.origin.setTo(0.5, 0.5);
|
||||
|
||||
// Create a tween that rotates a full 306 degrees and then repeats (loop set to true)
|
||||
// Create a tween that rotates a full 360 degrees and then repeats (loop set to true)
|
||||
game.add.tween(swirl).to({ rotation: 360 }, 2000, Phaser.Easing.Linear.None, true, 0, true);
|
||||
game.add.tween(swirl.transform.scale).to({ x: 4, y: 4 }, 1000, Phaser.Easing.Linear.None, true, 0, true, true);
|
||||
game.add.tween(swirl.transform.scale).to({ x: 4, y: 4 }, 4000, Phaser.Easing.Linear.None, true, 0, true, true);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -10736,6 +10736,11 @@ var Phaser;
|
|||
this._chainedTweens[i].start();
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
// YoYo and Loop are both on
|
||||
this._yoyoCount = 0;
|
||||
this.reverse();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18834,13 +18839,11 @@ var Phaser;
|
|||
if(value == true && this._paused == false) {
|
||||
this._paused = true;
|
||||
this.onPause.dispatch();
|
||||
// Hook to the above
|
||||
this.sound.pauseAll();
|
||||
this._raf.callback = this.pausedLoop;
|
||||
} else if(value == false && this._paused == true) {
|
||||
this._paused = false;
|
||||
this.onResume.dispatch();
|
||||
// Hook to the above
|
||||
this.input.reset();
|
||||
this.sound.resumeAll();
|
||||
if(this.isRunning == false) {
|
||||
|
|
Loading…
Reference in a new issue