why does stepify have no effect on delta?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Badduar


ich have this:

var test = 0.0

func _process(delta):
test += delta
stepify(test, 4)

when i print test i get in the first step a number like
when I use stepify its the same.

Does anyone have an idea what I’m doing wrong or how I can do it so that only the full seconds are displayed?

Many Thanks

:bust_in_silhouette: Reply From: Zylann

stepify does not modify its arguments because they are numbers, instead it provides the result as a return value.
However you might not want to apply this to test directly because that would cause the tiny difference added by delta to be lost.
If you want to see the stepified result, you can write:

print(stepify(test, 4))

Which should give you a result like a bunch of 0 for 4 seconds, then 1 until 8 seconds, then 2 etc.