I've tried so many different things, none of which worked which is why i'm asking this here. I've used the docs, other forum posts, i've even asked GPT-3 to give me something that can be used as an answer since i did do that before and it worked.
What i wanna do is duplicate an existing node, add the clone of the node as a child of the original node and move the clone with Vector2 at a predetermined speed. All of that needs to happen when a key is pressed.
My current code:
extends Sprite
onready var node = $"."
var speed = 8
func _process(delta):
if Input.is_action_pressed("game_debug"): #this is enter
var newnode = Sprite.new()
newnode.set_name("nodeClone")
newnode.add_child(node)
newnode.move_toward(Vector2(0, 0), speed * delta)
pass
there are multiple things wrong with this code alone and i might just be going crazy since this has been bothering me for the past like 8 days lmao help me please