0 votes

Hello,

ich have this:

var test = 0.0

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

when i print test i get in the first step a number like
5.339175
5.339175
5.355764
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
Badduar

in Engine by (12 points)

1 Answer

0 votes

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.

by (27,831 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.