invalid get index 'flip' (on base: "Sprite")

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Filip

Hi. I am new to godot. But, I have searched a lot of internet and even thought I found why this error keep poping, i wasnt able to get it work. So here is what i am doing:

Firs, I have node Player in main scene,
in that i have the Sprite node and CollisionShape2d

Then, I have a script in the Player node. And I want to flip the image (Sprite) with the script.
So that looks like that:

(I have moving the player and sprite in the script too, but this is not important)

extends KinematicBody2D

var score : int = 0

var speed : int = 200
var jumpForce : int = 600
var gravity : int = 800

var vel : Vector2 = Vector2()

onready var sprite : Sprite = get_node("Sprite")
 func _physics_process(delta):
	vel.x = 0
	if Input.is_action_pressed("move_left"):
		vel.x -= speed
	if Input.is_action_pressed("move_right"):
		vel.x += speed
	vel = move_and_slide(vel, Vector2.UP)
	if vel.x < 0:
		sprite.flip.h = true
	elif vel.x > 0:
		sprite.flip.h = false
:bust_in_silhouette: Reply From: kidscancode

Sprite doesn’t have a flip property. It has flip_h and a flip_v properties. You can see them in the Inspector, or in the Sprite documentation: