- Edited
extends KinematicBody2D
const ACCELERAZIONE = 500
const MAS_VELOCITA = 78.2
const FRIZIONE = 500
var velocity = Vector2.ZERO
onready var animationPlayer = $AnimationPlayer
func _physics_process(delta):
var input_vector = Vector2.ZERO
input_vector.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
input_vector.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
input_vector = input_vector.normalized()
if input_vector != Vector2.ZERO:
if input_vector.x > 0:
animationPlayer.play("destra")
else:
animationPlayer.play("sinistra")
velocity = velocity.move_toward(input_vector * MAS_VELOCITA, ACCELERAZIONE * delta)
else:
animationPlayer.play("idledestra")
velocity = velocity.move_toward(Vector2.ZERO, FRIZIONE * delta)
velocity = move_and_slide(velocity)
At "else:" in the 23,1 line it says "Unindent does not match any outer indentation level". I don't know how to solve this problem.