Hey!
It's me again... So I'm making a 2d Platformer game and when I want to do moveandslide
I get this error "Invalid type in function 'moveandslide' in base 'KinematicBody2d'. cannot convert argument 1 int to Vector2"
my moveandslide code is velocity = move_and_slide(velocity, Vector2.UP)
and I think this error means that my velocity is a integer but my velocity is Vector2(0, 0)
Here is the full code: `
extends KinematicBody2D
var speed = 100
var gravity = 100
var jump_force = 100
var velocity = Vector2(0,0)
func _physics_process(delta: float) -> void:
velocity.y += gravity
if Input.is_action_pressed("ui_left"):
velocity.x = -speed
elif Input.is_action_pressed("ui_right"):
velocity.x = speed
else:
velocity = 0
if Input.is_action_just_pressed("ui_up") and is_on_floor():
velocity.y = -jump_force
velocity = move_and_slide(velocity, Vector2.UP)
If you can help me then please do.
Thanks in advance! :)