Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | CainJäger |
I’m making a game and I want it to have a life counter (in number) and by taking damage logically decreasing the life on the label
Do you have a question? What have you made already? If you’re stuck on some part, bec specific about what you tried and what didn’t work.
The Godot tutorial game has examples of using labels and updating them:
https://docs.godotengine.org/en/stable/getting_started/step_by_step/your_first_game.html
kidscancode | 2020-09-05 23:44
I was researching before and watching some videos and I tried set_text, but nothing changed, in that part that I crashed, because I want it to be showing life in number and when colliding with the enemy, take 1 when taking damage
CainJäger | 2020-09-06 02:36
Well, you wouldn’t use set_text()
, you’d get a reference to your Label
node and set its text with label_node.text = str(some_number)
. But again, I can’t tell you what you may or may not be doing wrong without any more information. And if you crashed, it was for a reason, and the error message is very important - it tells you what is wrong.
kidscancode | 2020-09-06 04:08