It’s my first time using Godot, and i tried to code a simple move command:
extends CharacterBody2D
@export var speed = 14
@export var fall_accelleration = 75
var player_vel = Vector2.ZERO
func _ready() → void:
pass
func _process(delta: float) → void:
var direction = Vector2.ZERO
if Input.is_action_pressed("move_left"):
direction.x -= 1
if Input.is_action_pressed("move_right"):
direction.x += 1
player_vel.x = direction.x * speed
player_vel.y = direction.y * speed
player_vel = (direction.x + direction.y) / 2
and i keep getting this error: Invalid assignment of property or key ‘x’ with value of type ‘float’ on a base object of type ‘float’. And i don’t know how to fix this