0 votes

Hey guys , I am trying to convert delta into a int value for my score system ......score should increase with time but when i am trying to convert delta into a int value it always remain same at 0 but works when no change is made to it

func _process(delta):
$Score.text = str(score)
if pause != true:
    var d = delta * 1.0
    score += int(d)
asked Aug 12 in Engine by Pratik (22 points)

1 Answer

0 votes

is in the range of 0.0166...

delta*1.0 stays in the same range.
int(d) -> it will round to closest integer => 0 !

You need to multiply it by 100 or 1000 (depending on your needs)

answered Aug 12 by GameVisitor (169 points)

Thanks man for replying ..i tried many things with delta for score but nothing worked so i added a timer to main scene and on timeout added a score anyway but thanks for replying .....i will try to see how to do it with delta later

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.