My jump script is broken or I'm missing something. help.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By FranticButter

These are my scripts, they are all under func physics_process(delta):

const GRAV = 80
const JUMPF = -150

if Input.is_action_pressed("Jump"):
	if on_ground == true:
		motion.y = -JUMPF	
		on_ground = false
	motion.y = 0

motion.y += GRAV

if is_on_floor():
	on_ground = true
	on_ground = false

any input?

Have you also called move_and_slide() to get the player moving?

ejricketts | 2021-01-15 19:10

yes i have, just to forgot to mention it.
And then i realized i tried to make 2d movement with top down mechanics. I normalized the movement. And for some reason w makes me go upwards. I’m gonna fix that, sorry for wasting your time.

FranticButter | 2021-01-15 19:17

No worries, so are you all sorted?

ejricketts | 2021-01-15 19:21

Yes, I got it fixed and the movement working. When I started the project it was kinda late so I mistakenly wrote top down movement script for a 2d platformer.

FranticButter | 2021-01-16 04:16