0

Screenshot of 'Tao' node:

enter image description here

I can't find a tutorial or a guide on how to change the sprite of a child node dynamically. I need to change the sprite of 'baba' which is a child of 'Tao.

Here's my code and it's not working:

var tao = Tao.instance()
var spr = str("res://assets/tao", i+1)
tao.get_child("baba") = load(spr)
glennmark
  • 524
  • 3
  • 13

1 Answers1

1

I got the solution. Just wanna share.

var tao = Tao.instance()
var spr = str("res://assets/tao", i+1, ".png")
tao.get_node("baba").get_node("itsura").texture = load(spr)
glennmark
  • 524
  • 3
  • 13