Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Eclipse |
I have been making a small program where a box should spawn on my cursor every five seconds but when five seconds pass I get this error
Invalid set index ‘position’ (on base: ‘Vector2’) with value of type ‘Vector2’.
here is my code
extends Node
var box = preload(“res://box/Box.tscn”)
func _on_Timer_timeout():
var pos = get_viewport().get_mouse_position()
pos.position = Vector2(pos.x, pos.y)
add_child(box)