Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Robster | |
Old Version | Published before Godot 3 was released. |
Hi all,
I have a timer and all it’s really doing is counting up from 0 to whatever my score is.
The idea is, when the level is finished. Your score counts up in a dramatic way to make the player feel good about their progress.
Currently though, if the score were say 12, the timer would count:
2
, 4
, 6
, 8
, 10
, 12
Checking the debug info the data is definitely:
0
, 1
, 2
, 3
, 4
, 5
, 6
, 7
, 8
, 9
, 10
, 11
, 12
It’s just the drawing that’s out of timing with my actual data.
This is my code. I’m not sure what I’m doing wrong:
func countUpScore():
var freedTimer = Timer.new()
freedTimer.set_timer_process_mode(1)
freedTimer.connect("timeout",self,"_on_freedTimer_timeout")
freedTimer.set_wait_time(.3)
add_child(freedTimer) #to process
freedTimer.start() #to start
func _on_freedTimer_timeout():
print("global score: ", str(globals.score))
print("drawsci=ore: ", str(drawScore))
if drawScore <= globals.score:
drawScore += 1
get_node("yourScoreLabel").set_text("Your Score: %s" % str(drawScore))
I’ve changed the line freedTimer.set_wait_time(.3)
to have different values but no to avail, same issue.
Any advice would be appreciated.
Thank you.
Just tested this and it is working correctly on my end, all digits were displayed sequentially in the label.
ericdl | 2016-11-28 13:40