Game Freeze when I run it.

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

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)
:bust_in_silhouette: Reply From: SingingApple

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: Releases · kidscancode/Godot3_dodge · GitHub .
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.

Thank you a ton.

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

Sorry for being so carelessly :slight_smile:

Thank you very much for your help!

Fustyv | 2018-06-10 17:34