Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | thatsalottadimp | |
Old Version | Published before Godot 3 was released. |
Probably a simple question here, is there a way to write a function in a global script that takes a node as a parameter that can be called by any specific nodes in a scene? I’m trying to make an inventory system that I can instance into every scene that will have functions that tell what to do with an object when clicked. ie “putInInventory”, “sortInventory”, “combineItems”, etc. I’m guessing for the actual argument I could use the get_node but I’m not sure about the syntax for the parameter in the function definition. Would it be something like:
func moveItem(node):
node.set_pos(0,0)
Thanks!