![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | WaterDeveloper |
hey yall,
I’ve been working on projects around the year and i stumbled on this error for all of them.
the KinematicBody2D i use doesn’t jump normally and just teleports in air.
here’s my code:
extends KinematicBody2D
var max_speed = 7000
var velocity = Vector2.ZERO
func _physics_process(delta):
if Input.is_action_pressed("ui_right"):
velocity.x = max_speed
elif Input.is_action_pressed("ui_left"):
velocity.x = -max_speed
else:
velocity.x = 0
if Input.is_action_just_pressed("ui_up"):
velocity.y += -45000
velocity.y += 10000
velocity = move_and_slide(velocity * delta)
It’s worth mentioning that this case only happens when using delta, Which I like to use to keep things fair.
thanks in advance for all the answers!