FlxTween ignore timescale?

26 views
Skip to first unread message

Jeru Sanders

unread,
Nov 27, 2015, 6:57:22 PM11/27/15
to HaxeFlixel
Is there any way to have an FlxTween ignore FlxG.timescale and just tween in normal time? I can't even seem to find a hack way to do this besides extending FlxTween and overriding update(elapsed:Float):Void

Jeru Sanders

unread,
Nov 27, 2015, 8:10:55 PM11/27/15
to HaxeFlixel
Welp, I did it by extending NumTween like this:

package ;

import flixel.FlxG;
import flixel.tweens.FlxTween;
import flixel.tweens.misc.NumTween;

class FlxMintNumTween extends NumTween
{
public var ignoreTS:Bool = false;

public function new(options:Dynamic):Void
{
super(options);
}

public static function t(
start:Float,
end:Float,
time:Float,
f:Float->Void,
options:TweenOptions = null,
ignoreTimeStep:Bool = false)
{
var tw:FlxMintNumTween = new FlxMintNumTween(options);
tw.ignoreTS = ignoreTimeStep;
tw.tween(start, end, time, f);
return FlxTween.manager.add(tw);
}

override public function update(elapsed:Float):Void
{
if (ignoreTS) super.update(1/FlxG.updateFramerate)
else super.update(elapsed);
super.update(elapsed);
}
}

Then called it like this:

FlxMintNumTween.t(Reg.fader.alpha, 0, 0.5, function (f:Float) { Reg.fader.alpha=f; }, null, true);

But man was that not fun.
Reply all
Reply to author
Forward
0 new messages