#pause.

3 messages · Page 1 of 1 (latest)

bitter hill
#

so im working with damage numbers and i want the numbers to go up fast but also not instantly. i tried using an
await get_tree.create_timer(1).timeout
but for some reason it broke the whole thing and it just went up forever
heres the code im using

`extends Node2D
var blunt_damage = 0
var fire_damage = 0
var poison_damage = 0
var current_damage = 0 #the damage the player has already taken
var tempdam = 0
var total = 0

func _on_button_pressed() -> void:
blunt_damage += 10
total += blunt_damage

func _on_button_2_pressed() -> void:
fire_damage += 10

func _on_button_3_pressed() -> void:
poison_damage += 10

func _process(delta: float) -> void:
print(total)
while total != 0:
tempdam += 1
$Label2.text = str(tempdam)
print(tempdam)
if tempdam == total:
print("im stupid")
current_damage = total
total = 0`

im still decently new to godot so sorry if i dont know certain syntax

past latch
#

To make it slower you can add a Timer node to your scene and listen to its timeout signal