Reputation: 543
Screenshot of 'Tao' node:
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)
Upvotes: 0
Views: 2371
Reputation: 543
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)
Upvotes: 1