|
|
|
 |
Reply From: |
Skipperro |
Simple!
make a variable that is a number like:
var counter = 0
then you can change it freely, like:
counter += 10
and if you want to update the text label use:
YourLabel.text = str(counter)
YourLabel is of course your node and str function converts a number to string, which can be used with text fields.
Also, if you don’t know how to get YourLabel handle, you can do this by two ways:
one:
get_node("LabelNameHere")
two:
$LabelNameHere
in both cases Godot should give you tips as you start writing.
Ahh its the str thats missing in my codes haha THANKS.
EnderCreeper1st | 2019-08-28 11:34
i’m trying to use this in
func _process(delta):
## when i click and spawn a circle in
ballCountLabel.text = str(ballCount)
but then when i run it it says
[Label:1187
and then trails off the screen? or maybe that’s it, i dont know
Could you also provide the code showing what is ballCount?
Skipperro | 2020-06-26 17:45
I fixed it, nevermind. I stil have no idea why it showed “[Label:1187” though.
¿como lo arreglaste?
yo intento pasar la informacion de un label a otro label y tambien me pone label 1310, en lugar de poner la infomacion que tiene el otro label.
abraham | 2020-10-02 02:12
If I translated your Spanish correctly, you want to pass text from one label to another label, right?
To copy text from Label1 to Label2 you have to do something like this:
$Label2.text = $Label1.text
Skipperro | 2020-10-02 06:55