0 votes

I am following the Your First Game tutorial.
Wrote the player movement as described but whenever I press F5 to test it (Or F6) it is stuck on the Godot Engine logo, also I cannot exit it from the windows I have to go to the engine and press the stop bottom.

I can minimize it, but I cannot force quit it.

I had this problem previously, then I quit and removed the project and created a new one, and after that it did work.

Is it a classic IBM error?

The code I wrote is like this:

extends Area2D

export (int) var SPEED
var screensize

func _ready():
screensize = get_viewport_rect()

func _process(delta):

var velocity = Vector2()

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, screensize.x)
position.y = clamp(position.y, 0, screensize.y)
asked Jun 10 in Engine by Fustyv (15 points)

1 Answer

+1 vote
Best answer

Disclaimer: I am trying to help and bear no responsibilities for anything that goes wrong.

This is probably not the reason but your code seems to be wrong a bit. Check it character by character with the original code.
You can also try downloading and testing the code from here: https://github.com/kidscancode/Godot3_dodge/releases .
If it works fine with that, then you probably made a mistake somewhere.
If it doesn't, please comment and I will try to help ASAP.

answered Jun 10 by SingingApple (365 points)
selected Jun 10 by Fustyv

Thank you a ton.

The problem was the code, took me long enough to figure out.

Sorry for being so carelessly :)

Thank you very much for your help!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.