![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | rodell2020 |
My HUD scene is made
canvasLayer2D (renamed HUD) the root node with the hud.gd (see below)
Panel
(with TextureRect which put an image of the coin on the screen)
(with X which is a label used to put an X on the screen)
Coin (which is RichTextLabel)
my hud.gd script
extends CanvasLayer
var coins = 0
var rng = RandomNumberGenerator.new()
func _ready():
$Coin.text = String(“coins”)
func _on_coin_collected():
coins = coins + 1
_ready()
func _physics_process(delta):
pass
func _on_QB_random_coins():
rng.randomize()
var random_coins = rng.randi_range(1,10)
coins = coins + random_coins
_ready()
in Godot 3.4.4. it work it
put then image of my coin an X followed by the total of coins
each time I added 1 to coins it would go from 1 to 2 to 3 etc…
but in Godot 4
its the word coins up (and does not change)