Scene freezes when i try to launch it

Godot Version

4.7.2 stable

Question

when i try to launch the scene of the movement of the player (similas movement to games like undertale and deltarune if it helps), it crashes, giving the error physics_process_: invalid call. nonexistent ´vector2´ constructor. since i started programming one week ago, i have no idea what this means. any clue?

extends CharacterBody2D

var velocidad = 200
var animacion = ""

@onready var animaciones = $Sprites_Jugador
@onready var mira = $RayCast_Jugador

func _physics_process(_delta):
	
	var movimiento = Vector2(velocidad)
	
	if Input.is_action_pressed("ui_up"):
		movimiento.y -= velocidad
		
	if Input.is_action_pressed("ui_down"):
		movimiento.y += velocidad
		
	if Input.is_action_pressed("ui_right"):
		movimiento.x += velocidad
		
	if Input.is_action_pressed("ui_left"):
		movimiento.x -= velocidad
		
	move_and_slide()

A Vector2 needs 2 elements (X,Y), but your velocity variable is a single integer.

The problem is Vector2(velocidad) — Vector2 needs two values, like Vector2(0, 0). Try using velocity = Vector2.ZERO and then change velocity.x/velocity.y before move_and_slide(). Also check that svgsvg before extends isn’t actually in your script.

Change this to

var movimiento: Vector2

Then you create and empty vector2

The Vector2 constructor problem aside, you are also not setting the character’s `velocity` before calling `move_and_slide`, so the `move_and_slide` will do nothing.