Skip to content

Commit e3bd25a

Browse files
committed
Tidying up
1 parent 347209a commit e3bd25a

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

v3/src/gameobjects/pathfollower/PathFollower.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ var PathFollower = new Class({
2525
{
2626
if (config === undefined) { config = {}; }
2727

28+
if (this.pathTween && this.pathTween.isPlaying())
29+
{
30+
return;
31+
}
32+
2833
if (typeof config === 'number')
2934
{
3035
config = { duration: config };
@@ -34,13 +39,27 @@ var PathFollower = new Class({
3439
config.from = 0;
3540
config.to = 1;
3641

42+
// Can also read extra values out of the config, like autoRotate
43+
3744
this.pathTween = this.scene.sys.tweens.addCounter(config);
3845

3946
// The starting point of the path, relative to this follower
4047
this.path.getStartPoint(this.pathOffset);
4148

4249
this.pathOffset.x = this.x - this.pathOffset.x;
4350
this.pathOffset.y = this.y - this.pathOffset.y;
51+
52+
return this;
53+
},
54+
55+
stop: function ()
56+
{
57+
if (this.pathTween && this.pathTween.isPlaying())
58+
{
59+
this.pathTween.stop();
60+
}
61+
62+
return this;
4463
},
4564

4665
/*

0 commit comments

Comments
 (0)