So, i have a simple kinematic 2d character with this code
extends KinematicBody2D
export var direction = Vector2(0,0)
export var walk_speed = 200
export var jump_speed = -400
export var gravity = 200
func _ready():
pass
func _physics_process(delta):
direction.y += gravity * delta
direction.x = 0
if Input.is_action_pressed("left"):
direction.x -= walk_speed
if Input.is_action_pressed("right"):
direction.x += walk_speed
if Input.is_action_just_pressed("jump"):
direction.y = jump_speed
var movement = move_and_slide(direction, Vector2(0,-1))
And it works well, but it isn't consistent (obviously) so in my move and slide function, i added:
var movement = move_and_slide(direction * delta, Vector2(0,-1)
The only problem is that it causes my character to move very slowly. I tried increasing the jumpspeed and walkspeed variables, which works somewhat, but it seems like they would need to be big numbers to move correctly and i would rather deal with smaller variables.
So, is there a way to fix this, or do i have to multiply my variables by a hundred?
Also, out of curiosity, why does multiplying it with delta cause this?