+1 vote

Hey!
How can i draw numbers on screen when i, for example, shoot bullets..
I have a bullet counter that i can keep track only in print() ...
How can i make that counter to appear and update on screen, like,,, in a corner of the window

in Engine by (225 points)

1 Answer

+2 votes
Best answer

Hi,

It's simple, you must use a Label node, place it on a corner of the screen, then :

var count = 42
get_node("Label").set_text(str(count ))

for taking change if frame you must call this in func _process(delta):, see Processing doc

by (362 points)
selected by

You can use draw_string too, look at "Custom Drawing in 2D" on the docs and the draw functions of CanvasItem
http://docs.godotengine.org/en/stable/classes/class_canvasitem.html

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.