Please help (Vecto 2)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ShaneGrey413
:warning: Old Version Published before Godot 3 was released.

Here is the error I am getting: Invalid call. Nonexistent function ‘vector2’ in base ‘KinematicBody2D (KinematicBody2D.gd)’.

Why can’t I use vector2 with my KinematicBody2D that makes no sense to me. Can someone answer this and let me know an alternative to making this script that will work or tell me what I did wrong?

Here is my script

 extends KinematicBody2D

export var motion_speed = 140
var RayNode

func _ready():
set_fixed_process(true)
RayNode = get_node(“RayCast2D”)

func _fixed_process(delta):
var motion = vector2()

if (Input.is_action_pressed("ui_up")):
	motion += Vector2(0, -1)

if (Input.is_action_pressed("ui_down")):
	motion += Vector2(0, 1)

if (Input.is_action_pressed("ui_right")):
	motion += Vector2(1, 0)
	RayNode.set_rotd(-90)
	
if (Input.is_action_pressed("ui_left")):
	motion += vector2(-1, 0)
	RayNode.set_rotd(90)
	
motion = motion.normalized()*motion_speed*delta
move (motion)
:bust_in_silhouette: Reply From: alexholly

Vector2(1, 0)
vector2(-1, 0)

mAYbe SoMe UppEr/LoWer CaSe IssUe?

THANK YOU SO MUCH LOL. IT WAS SERIOUSLY THAT SIMPLE ROFL

ShaneGrey413 | 2017-05-07 00:18