Godot Engine: how to use external fonts and Label nodes make a timer

1. Import font files

First import the font file, Godot TTF and OTF supports two common font formats.

Here Insert Picture Description

2. set up the scene

Here Insert Picture Description

3. The basic parameters of the Label

Here Insert Picture Description

4. CreateDynamicFont

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

5. Set Timer

Here Insert Picture Description

6. timer script

Here Insert Picture Description

#Counter.gd
extends Label

var time = 0

func _ready():
	text = str(time)
	$"../Timer".connect("timeout",self,"count")

func count():
	time += 1
	text = str(time)

7. Test Run

Here Insert Picture Description

Published 379 original articles · won praise 1142 · Views 180,000 +

Guess you like

Origin blog.csdn.net/hello_tute/article/details/105073585