Rounding number on tween

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By WellStacked
value = 100
new value = 200.25
$tween.interpolate_property(self, "value", value, new_value, 2.6, Tween.TRANS_LINEAR, Tween.EASE_IN)

when triggered animation, numbers appear 195.423599 etc
stepify(value,0.01) not help

I want to get only numbers 100.53, 160.62, 195.22 etc

:bust_in_silhouette: Reply From: volzhs
var value = 100

func call_tween(new_value):
    $tween.interpolate_method(self, "set_value", value, new_value, 2.6, Tween.TRANS_LINEAR, Tween.EASE_IN)

func set_value(p_value):
    value = stepify(p_value)
    # do something with value

/del

I solved the problem, the error was quite different. But thanks for the help!

WellStacked | 2019-05-19 16:15