You didn't say where exactly in that code the error is happening.
One thing I notice: you use spawnInstance.set_pos()
, but set_pos()
requires an argument - you have to set the position to something.
http://docs.godotengine.org/en/stable/classes/class_node2d.html#class-node2d-set-pos
Also, this:
func _input(event):
var spawnInstance = spawnReference.instance()
Is not a good thing. You're spawning an instance of that scene every time the input function is called. But that happens on any input event, including mouse movement, etc.
In general, it's a better idea to use the input map and create input actions for any input you want to process. That way it's easier to change input keys, transition to gamepad or touch, etc.