So when I add "and isonfloor()" it makes the jump function not work at all, but it works before I add the "isonfloor()", I have the floor defined with velocity = moveandslide(velocity, Vector2.UP) so idk, any help? Here's my code;
extends KinematicBody2D
var velocity = Vector2(0,0)
const Speed = 200
const Jumpforce = -900
const Gravity = 30
func _physics_process(delta):
if Input.is_action_pressed("right"):
velocity.x = Speed
if Input.is_action_pressed("left"):
velocity.x = -Speed
move_and_slide(velocity)
velocity.y = velocity.y + Gravity
if Input.is_action_just_pressed("Jump") and is_on_floor():
velocity.y = Jumpforce
velocity = move_and_slide(velocity, Vector2.UP)
velocity.x = lerp (velocity.x,0,0.2)