I am working on a stg game, and I find the moving speed of the projectile is weird. The projectile moves faster when the player move in the y direction. But I want the speed keep constantly, how could I fix this?
Player movement code:
var velocity = Vector2(0,0)
var speed = 300
func _process(delta):
velocity.x = int(Input.is_action_pressed("move_right")) - int(Input.is_action_pressed("move_left"))
velocity.y = int(Input.is_action_pressed("move_down")) - int(Input.is_action_pressed("move_up"))
velocity = velocity.normalized()
global_position += velocity * speed * delta
Projectile movement code:
var velocity = Vector2(0, -1)
export var speed = 500
func _process(delta):
global_position += velocity * speed * delta
