File tree Expand file tree Collapse file tree
v3/src/gameobjects/pathfollower Expand file tree Collapse file tree Original file line number Diff line number Diff 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 /*
You can’t perform that action at this time.
0 commit comments