in my game I run this code on the player
func physicsprocess(delta: float) -> void:
if Input.isactionjustpressed("attack"):
var magic = spell.instance()
getparent().add_child(magic)
var spell = load("res://scenes/progectile.tscn")
and this on my projectile
extends KinematicBody2D
var velocity = Vector2.ZERO
func _ready() -> void:
if Global.area == 1:
velocity.y = -190
if Global.area == 2:
velocity.y = 190
if Global.area == 3:
velocity.x = 190
if Global.area == 4:
velocity.x = -190
func physicsprocess(delta: float) -> void:
moveandslide(velocity)
func onTimertimeout() -> void:
queuefree()
but whenever my player moves so does my projectile
how do I fix it