Tween.onLoop would be fired when a Tween repeated and Tween.onRepeat would be fired when a Tween looped. These are now reversed to fire correctly (thanks @vladkens #2024)

This commit is contained in:
Richard Davey 2016-02-17 02:57:45 +00:00
parent 071d9cffd0
commit 15411f1e56
2 changed files with 12 additions and 4 deletions

View file

@ -378,6 +378,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
* ctrl + click is now only considered a right-click if event.buttons = 1, this should allow you to use ctrl as a key modifier on Windows (and any device with a multi-button mouse attached) and still use ctrl + click on OS X / trackpads for a right-click (thanks @yuvalsv #2167)
* If the Mouse was over a Sprite and you then clicked it, it would dispatch another Over event. This is now surpressed if the Over event has already been dispatched previously (thanks @McFarts #2133)
* InputHandler.pointerOver could fail to return anything in some instances, now always returns a boolean.
* Tween.onLoop would be fired when a Tween repeated and Tween.onRepeat would be fired when a Tween looped. These are now reversed to fire correctly (thanks @vladkens #2024)
### Pixi Updates

View file

@ -198,7 +198,7 @@ Phaser.Tween.prototype = {
* @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden.
* @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start().
* @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay.
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this induvidual tween, not any chained tweens.
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this individual tween, not any chained tweens.
* @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead.
* @return {Phaser.Tween} This Tween object.
*/
@ -245,7 +245,7 @@ Phaser.Tween.prototype = {
* @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden.
* @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start().
* @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay.
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this induvidual tween, not any chained tweens.
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this individual tween, not any chained tweens.
* @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead.
* @return {Phaser.Tween} This Tween object.
*/
@ -763,7 +763,14 @@ Phaser.Tween.prototype = {
}
else if (status === Phaser.TweenData.LOOPED)
{
this.onLoop.dispatch(this.target, this);
if (this.repeatCounter === -1)
{
this.onLoop.dispatch(this.target, this);
}
else
{
this.onRepeat.dispatch(this.target, this);
}
return true;
}
else if (status === Phaser.TweenData.COMPLETE)
@ -798,7 +805,7 @@ Phaser.Tween.prototype = {
if (this.repeatCounter === -1)
{
this.timeline[this.current].start();
this.onRepeat.dispatch(this.target, this);
this.onLoop.dispatch(this.target, this);
return true;
}
else if (this.repeatCounter > 0)