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