Problems from start

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

Trying to make “Catch the creep” from tutorial, but after adding

‘if velocity.length() > 0:
velocity = velocity.normalized() * speed’

My blob don’t move and just play animation

Here is full code what i did

extends Area2D

export var speed = 400
var screen_size

func _ready():

screen_size = get_viewport_rect().size

func _process(_delta):

var velocity = Vector2()
if Input.is_action_pressed("ui_right"):
	velocity.x += 10
if Input.is_action_pressed("ui_left"):
	velocity.x -= 10
if Input.is_action_pressed("ui_down"):
	velocity.y += 10
if Input.is_action_pressed("ui_up"):
	velocity.y -= 10
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)
:bust_in_silhouette: Reply From: Inces

You have put main branch of code under ELSE statement. Position += velocity * delta abd clamping position must be indented left.