Label and Sprite problems

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Newby

The set_text and set_texture in my scene dont work when i add in data
here is the code for the set_

extends Control
export(int) var MAX_HP

var HP

export(String, "MAGIC", "MELEE", "RANGE") var ATTACKS
export(String, MULTILINE) var UNIT_NAME
export(Texture) var SPRITE

func ready():
randomize()
HP=MAX_HP
get_node("HP").set_text(str(HP))
get_node("Name").set_text(UNIT_NAME)
get_node("Sprite").set_texture(str(SPRITE))

i don’t know what is wrong

:bust_in_silhouette: Reply From: hilfazer

If You copypasted Your code then there’s a typo in _ready() method name - underscore is missing.

Don’t convert SPRITE to string

str(SPRITE)

set_texture() accepts Texture type.

thanks man forgot that the ready func needs an underscore in the front

Newby | 2018-02-25 11:10