![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | digopauletti |
Hi.
I’m following this Godot tutorial Your First Game and this error occurred to me:
error(24,1): Unindent does not match any outer indentation level.
Here is my script:
extends Area2D
export (int) var SPEED # how fast the player will move (pixels/sec)
var screensize # size of the game window
func _ready():
screensize = 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 // This is the line 24
position.x = clamp(position.x, 0, screensize.x)
position.y = clamp(position.y, 0, screensize.y)
What am I doing wrong?
I’m a beginner in python
Thanks!