Can not get my (player) area2D to move (dodging the creeps tutorial)

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

Hi All,

OS: WIndows 10
Godot version:3.1

I am very new to programming and also new to Godot. So I want to ask you to be patient.
So I am following the tutorial “your first game” on the Godot learn page.
I have followed the steps as described in the tutorial several times, but i can not get further then the chapter “moving the player”.
I follow the steps like described in the tutorial, the first few times i could strart the app but there was no reaction to my input, de player didnt move.
So after trying some stuff I now get the following error:
“E 0:00:00:0441 Condition ’ _debug_parse_err_line >= 0 ’ is true. returned: __null
modules/gdscript/gdscript_editor.cpp:321 @ debug_get_stack_level_instance()”
I can not find the answer…

My version of the game can be downloaded from the following link:
WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free.


Your link does not work. Can you just post the player code here? Use the “Code Sample” formatting button above when you paste it.

The message implies you have an error in one line of your code. What “stuff” did you try?

kidscancode | 2019-03-19 15:53

Oh I see, I will post the code.

extends Area2D

export var speed = 400 # How fast the player will move (pixels/sec).
var screen_size # Size of the game window.

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

position += velocity * delta
position.x = clamp(position.x, 0, screen_size.x)
position.y = clamp(position.y, 0, screen_size.y)

jabba | 2019-03-19 19:29

That code is unreadable. Please format it. There’s a button above the editor window, it looks like {}

kidscancode | 2019-03-19 19:33

:bust_in_silhouette: Reply From: jabba

I want to thank you for your answer earlier today.
I have tried it again from zero for the sixed time today, this time it worked.

Thank u.