I tried to make it so my character turns right when I tell him to go right, but for some weird reason he changes his vertical scale. I even tried to make it so when the vertical scale is -1 to set it to 1 but then it conflicts with something else and he just does some weird stuff.
Heres the code:
extends KinematicBody2D
var velocity = Vector2(0,0)
const SPEED = 180
var jumpforce = -800
const gravity = 30
var _scale1 = Vector2(1,1)
func physicsprocess(_delta):
if Input.is_action_pressed("right"):
velocity.x = SPEED
if Input.is_action_pressed("left"):
velocity.x = -SPEED
velocity.y = velocity.y + gravity
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = jumpforce
if Input.is_action_just_pressed("atak 2"):
$Sprite/atak.play("atak dzida")
velocity = move_and_slide(velocity,Vector2.UP)
velocity.x = lerp(velocity.x,0,0.5)
if Input.is_action_just_pressed("atak"):
$Sprite/atak.play("atak")
if Input.is_action_just_pressed("left"):
_scale1 = Vector2(1,1)
set_scale(_scale1)
if Input.is_action_just_pressed("right"):
_scale1 = Vector2(-1,1)
set_scale(_scale1)
I don't get any errors so idk what is going on.