Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Erto |
Hi.
Im following a youtube tutorial by Eli Cuaycong (https://www.youtube.com/watch?v=xFEKIWpd0sU)
And for some reason, it says: Unindent does not match any outer indentation level. In the video, there isn’t an issue like that. And looking at the code I can’t find a reason using my own logic either.
I would appreciate some help.
Thanks!
enter coextends KinematicBody2D
const UP = Vector2(0,-1)
const GRAVITY = 20
const MAXFALLSPEED = 200
const MAXSPEED = 200
const JUMPFORCE = 400
const ACCEL = 10
var motion = Vector2()
var facing_right = true
func _ready():
pass
func _physics_process(delta):
motion.y += GRAVITY
if motion.y > MAXFALLSPEED:
motion.y = MAXFALLSPEED
if facing_right == true:
$Sprite.scale.x = 1
else:
$Sprite.scale.x = -1
motion.x = clamp(motion.x,-MAXSPEED,MAXSPEED)
if Input.is_action_pressed("right"):
motion.x += ACCEL
facing_right = true
$AnimationPlayer.play("RUN")
elif Input.is_action_pressed("left"):
motion.x -= ACCEL
facing_right = false <- this DOESNT WORK
$AnimationPlayer.play("RUN")
else:
motion.x = lerp(motion.x,0.0.2)
$AnimationPlayer.play("IDLE")
if is_on_floor():
if Input.is_action_just_pressed("jump"):
motion.y = -JUMPFORCE
if !is_on_floor():
if motion.y < 0:
$AnimationPlayer.play("JUMP")
elif: motion.y > 0:
$AnimationPlayer.play("FALL")
motion = move_and_slide(motion,UP)
de here