How to fix this? bug with making playerr flip

Godot Version

4.7.2

Question

I tried making the player flip to the walk direction, and I got error!

“Invalid assignment of property or key ‘flip_h’ with value of type ‘bool’ on a base object of type ‘AnimatedSprite2D’.”

	# Flip Sprite
	if direction < 0:
		AnimatedSprite2D.flip_h = false
	elif direction > 0:
		AnimatedSprite2D.flip_h = true
	

AnimatedSprite2D is the class. You need to access your instance, the specific node in your scene tree.

If your AnimatedSprite2D is child node. You may need to add $

extends CharacterBody2D

func _ready() → void:
  $Sprite2D.flip_h = true

its because ur doing it on the Class AnimatedSprite2D instead of a sprite node