The code looks right to be. What version of Godot are you using?
The only thing I can think of that might cause an issue is that you are not passing an upwards vector in the move_and_slide function call, though if that is causing the issue then it is a bug. Maybe try changing it to move_and_slide(velocity, Vector2.UP
) and see if that helps?
I would also suggest trying the code on the Godot documentation for KinematicBody2D and see if it works.
Also:
This discussion was caught in the moderation queue since you have not confirmed your account yet.
Upon creating your account you should have received an account verification email. The confirmation email may have been incorrectly flagged as spam, so please also check your spam filter. Without confirming your account, future posts may also be caught in the moderation queue. You can resend a confirmation email when you log into your account if you cannot find the first verification email.
If you need any help, please let us know! Thanks! :smile:
Finally: welcome to the forums! :smile: