Skip to content

Commit e4887c8

Browse files
committed
If Tween.yoyo was true but repeat was 0 then it wouldn't yoyo. Now if yoyo is set, but not repeat, the repeat count gets set to 1 (thanks @hilts-vaughan, fix phaserjs#744)
1 parent 6ace9e6 commit e4887c8

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Version 2.0.4 - "Mos Shirare" - in development
7474
* The Emitter no longer checks if minParticleScale = maxParticleScale for the scale check, allowing for fixed scale particles again.
7575
* The PIXI.AbstractFilter is now included in the Phaser Pixi build by default, allowing for easier use of external Pixi Filters.
7676
* All Game Objects have a new property: destroyPhase (boolean) which is true if the object is in the process of being destroyed, otherwise false.
77+
* If Tween.yoyo was true but repeat was 0 then it wouldn't yoyo. Now if yoyo is set, but not repeat, the repeat count gets set to 1 (thanks @hilts-vaughan, fix #744)
7778

7879

7980
### New Features

build/phaser.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3434,8 +3434,8 @@ declare module Phaser {
34343434
multiply(x: number, y: number): Phaser.Point;
34353435
normalise(): Phaser.Point;
34363436
rotate(x: number, y: number, angle: number, asDegrees: boolean, distance?: number): Phaser.Point;
3437-
set(x: number, y: number): Phaser.Point;
3438-
setTo(x: number, y: number): Phaser.Point;
3437+
set(x: number, y?: number): Phaser.Point;
3438+
setTo(x: number, y?: number): Phaser.Point;
34393439
subtract(x: number, y: number): Phaser.Point;
34403440
toString(): string;
34413441

src/tween/Tween.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ Phaser.Tween.prototype = {
212212
repeat = repeat || 0;
213213
yoyo = yoyo || false;
214214

215+
if (yoyo && repeat === 0)
216+
{
217+
repeat = 1;
218+
}
219+
215220
var self;
216221

217222
if (this._parent)
@@ -456,6 +461,7 @@ Phaser.Tween.prototype = {
456461
repeat: function (times) {
457462

458463
this._repeat = times;
464+
459465
return this;
460466

461467
},
@@ -471,6 +477,12 @@ Phaser.Tween.prototype = {
471477
yoyo: function(yoyo) {
472478

473479
this._yoyo = yoyo;
480+
481+
if (yoyo && this._repeat === 0)
482+
{
483+
this._repeat = 1;
484+
}
485+
474486
return this;
475487

476488
},
@@ -717,7 +729,6 @@ Phaser.Tween.prototype = {
717729
this.onLoop.dispatch(this._object);
718730

719731
return true;
720-
721732
}
722733
else
723734
{

0 commit comments

Comments
 (0)