Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Noob_Maker | |
Old Version | Published before Godot 3 was released. |
I’m doing the controls and It’s not really working and It might has to do with this error right here:
error(13,0): Unindent does not match any outer indentation level.But I have no idea how to fix it. Here's the code by the way:
extends KinematicBody2D
const GRAVITY = 500.0
const WALK_SPEED = 200
var velocity = Vector2()
func _fixed_process(delta):
velocity.y += delta * GRAVITY
if (Input.is_action_pressed ("Left")):
velocity.x += -WALK_SPEED
elif (Input.is_action_pressed("Right")):
velocity.x -= WALK_SPEED
else:
velocity.x = 0
var motion = velocity * delta
move( motion )
if (is_colliding()):
var n = get_collision_normal()
motion = n.slide(motion)
velocity = n.slide(velocity)
move(motion)
func _ready():
set_fixed_process(true)