Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dondudding |
I’m still very new to this. In fact, I am working through a basic tutorial and as far as I can tell, I typed in the script verbatim from the tutorial video. I keep getting an error that says “Parser Error: ‘:’ expected at end of line” and there’s one there. If anyone could look at this script below (it’s a basic platform player controller) and tell me where I’m screwing up, it would be much appreciated. I’ve got some great ideas for using Godot if I can just get past these early snafus. Thanks.
extends KinematicBody2D
const UP = Vector2(0,-1)
const GRAVITY = 20
const SPEED = 200
const JUMP_HEIGHT = -850
var motion = Vector2()
func _physics_process(delta):
motion.y += GRAVITY
if Input.is_action_pressed("ui_right"):
motion.x = SPEED
else Input.is_action_pressed("ui_left"):
motion.x = -SPEED
else:
motion.x = 0
if is_on_floor():
if Input.is_action_pressed(“ui_up”):
motion.y = JUMP_HEIGHT
motion = move_and_slide(motion, UP)
pass
The error message is focused on the first else statement
else Input.is_action_pressed(“ui_left”):