Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Rensae |
For something like const MONSTER: { "shadow": { "sprite: "res://[insert file path], "hp": 20, "atk": 15 }, }
And I want to retrieve it on another script, how can I do it ?
I know that, to retrive a picture, you can assign a variable with, for exemple :
var monster = $"[node path].get_monster("monster_name")"
with a function
func get_monster(monster_id): if monster_id in MONSTER: return MONSTER[monster_id] else: return null
Then you can just load it with load(monster.sprite)
It’ll be used to get a monster in the dictionnary, and when it’s chosen it’ll apply those values in his stats. But I can’t figure it out, it keeps saying me that it’s not possible in a “Dictionnary”
Hope there is enough info on it