func _process(delta: float) -> void:
	var input_vector = Vector2.ZERO
	input_vector.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
	input_vector.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
	input_vector = input_vector.normalized()
	
	if input_vector.x > 0:
		$PlayerSprite.set_flip_h(false)
	elif input_vector.x < 0:
		$PlayerSprite.set_flip_h(true)

was wondering if flipping my Sprite would cause any significant lag in the long run(im using similar code in other process functions too) i was wondering if there was a more elegant way or if the engine is smart enough not to tick that box every frame

That is just a boolean check and a single function call. It won't make much of a difference in terms of performance. When you call flip h, if you are passing the same value then nothing happens visually (only if the value changes). So there is essentially no cost. I mean, there is still some cost, but you could easily make thousands of calls before you could measure any drop in the FPS.

Also, you could do this to collapse it to one line (this is technically faster, but you could never notice):

$PlayerSprite.set_flip_h(input_vector.x < 0)

However, using $ (or get_node) could be a performance issue with lots of calls. So you should put this at the top of the script.

onready var player_sprite = $PlayerSprite

Then do this:

player_sprite.set_flip_h(input_vector.x < 0)

Here is the full script.

onready var player_sprite = $PlayerSprite

func _process(delta: float) -> void:
	var input_vector = Input.get_vector("move_left", "move_right", "move_up", "move_down")
	player_sprite.set_flip_h(input_vector.x < 0)
Write a Reply...