Need help with a tutorial error

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

export var speed = 400
var screen_size

func _ready():
screen_size = get_viewport_rect().size

func _process(delta):

var velocity = Vector2()  # The player's movement vector.
if Input.is_action_pressed("ui_right"):
    velocity.x += 1
if Input.is_action_pressed("ui_left"):
    velocity.x -= 1
if Input.is_action_pressed("ui_down"):
    velocity.y += 1
if Input.is_action_pressed("ui_up"):
    velocity.y -= 1
if velocity.length() > 0:
    velocity = velocity.normalized() * speed
    $AnimatedSprite.play()
else:
    $AnimatedSprite.stop()	
	
position += velocity * delta
position.x = clamp(position.x, 0, screen_size.x)
position.y = clamp(position.y, 0, screen_size.y)

I copied the tutorial and code exactly as it said yet I still get an error that says - error (26,1): Unindent does not match any outer indentation level.
I’ve read others questions on lining up the indents with the if’s and the else but I lined them up but the error still persisted. I really want to learn a real game engine that’s not something like code.org but this is already a weird language to me with all the indenting.

:bust_in_silhouette: Reply From: kidscancode

Those lines under func _process(delta): should be indented.

This is most common when you copy-and-paste instead of typing the code yourself. Copying from a webpage will usually destroy the formatting of code. In addition, you should really be typing it yourself, as it will result in much more understanding and retention, even if you’re just following along with a tutorial.

It doesn’t show in the code format in the question but the lines under the func _process(delta); are indented by one each

Disregard that after going back and re-indenting everything manually the error went away but that leaves me with a side question how exactly does the indentation system work in this language?

Connor29 | 2019-04-01 21:20