All Questions

Community

W
Billy Westbury
posted to: Air movement

Jetpack

Hi how would you add a jetpack type state? thanks
  • Nathan Lovato replied

    It depends on how you want it to work in game. I'd have a variable to keep track of the jet-pack's fuel, have a dedicated jet-pack state as a child of the Move state, and in its physics_process callback, I'd override or extend the way vertical movement works:

    if Input.is_action_pressed("use_thrusters"):
        _velocity.y -= thrusters_power * delta
        fuel -= delta
    

    It depends on the exact movement of the jet-pack. But that's some of the logic you could use to make the character move back and forth with some inertia