export (int) var jump_speed = -400 export (int) var gravity = 1200 var jumping = false func _physics_process(delta): if Input.is_action_just_pressed('jump') and is_on_floor(): jumping = true velocity.y = jump_speed if jumping and Input.is_action_just_released("jump"): if velocity.y < -50: velocity.y = -50 velocity.y += gravity * delta velocity = move_and_slide(velocity, Vector2.UP) if jumping and is_on_floor(): jumping = false
Dienstag, 12. September 2023
Mega Man 9 Jump
Abonnieren
Posts (Atom)