Change path duration (speed) while it's playing?

In this project I am working in my client requested a “fast forward” button to speed up the game animation, meaning that mostly I have to double the speed that a sprite takes to cover the whole path.

Knowing that my main enemy is created this way:

var enemy = "enemy";
this[enemy] = this.add.follower(mypath, -20, 200, enemy).startFollow({
    duration: 5000,
    loop: -1
});

I then tried the approach below (and that didn’t work):

this[enemy].pathTween.duration = 1000;
this[enemy].pathTween.totalDuration = 1000;

It didn’t raised any error but just didn’t change anything.

There is a way of doing what I am after?

I would look into (possibly) changing the timescale
https://photonstorm.github.io/phaser3-docs/Phaser.Tweens.Tween.html#setTimeScale__anchor

2 Likes

Thank you thenonamezz, it did the trick!

this.tweens.timeScale = 2;

However while it will cover perfeclty what I am in need currently I was thinking if there is a way to control only a specific tween instead to affect ALL tweens at once? I can imagine one or two scenarios where it would be quite usefull!

:thinking:

There should be a setting on the individual Tween so you Can do it there too