Skip to main content
Code formatting
Source Link
DMGregory
  • 140.8k
  • 23
  • 257
  • 401

Here’s a easy method using a Label node:

extends Label

Set the textual content you want to display

var display_text = "Hello"

func _ready(): var x_offset = zero for char in display_text: var char_label = Label.New() char_label.Textual content = char char_label.Rect_position.X = x_offset add_child(char_label)

 # Adjust x_offset based totally at the font's xadvance cost x_offset = char.Get_xadvance() * 0.5 # Adjust the multiplier as wanted 
extends Label # Set the textual content you want to display var display_text = "Hello" func _ready(): var x_offset = zero for char in display_text: var char_label = Label.New() char_label.Textual content = char char_label.Rect_position.X = x_offset add_child(char_label) # Adjust x_offset based totally at the font's xadvance cost x_offset = char.Get_xadvance() * 0.5 # Adjust the multiplier as wanted 

Here’s a easy method using a Label node:

extends Label

Set the textual content you want to display

var display_text = "Hello"

func _ready(): var x_offset = zero for char in display_text: var char_label = Label.New() char_label.Textual content = char char_label.Rect_position.X = x_offset add_child(char_label)

 # Adjust x_offset based totally at the font's xadvance cost x_offset = char.Get_xadvance() * 0.5 # Adjust the multiplier as wanted 

Here’s a easy method using a Label node:

extends Label # Set the textual content you want to display var display_text = "Hello" func _ready(): var x_offset = zero for char in display_text: var char_label = Label.New() char_label.Textual content = char char_label.Rect_position.X = x_offset add_child(char_label) # Adjust x_offset based totally at the font's xadvance cost x_offset = char.Get_xadvance() * 0.5 # Adjust the multiplier as wanted 
Source Link

Here’s a easy method using a Label node:

extends Label

Set the textual content you want to display

var display_text = "Hello"

func _ready(): var x_offset = zero for char in display_text: var char_label = Label.New() char_label.Textual content = char char_label.Rect_position.X = x_offset add_child(char_label)

 # Adjust x_offset based totally at the font's xadvance cost x_offset = char.Get_xadvance() * 0.5 # Adjust the multiplier as wanted