How to i make my character fall 50% faster when you hold a specific key (gdscript)

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

Hello, I started making a 2d platformer beat-em-up this week.It is my first ever project and I am not experienced with godot.My player can move left and right and he also has 3 jumps (they reset when he touches the floor).I wanted a way to make him fall faster (fast fall mechanic) when I press down/s etch.I tried to implement it myself and got no compiling errors but it didn’t work.

:bust_in_silhouette: Reply From: Rev

Please show us the relevant parts of your project. That way we can diagnose what’s wrong or missing.

:bust_in_silhouette: Reply From: trien
var Geavity = 10

func _physics_process(delta):
    If Input.is_action_pressed(the button):
         Gravity = Gravity * 1.5

This worked perfectly. The only modification i made is to save the old gravity in order to reset it after i calculate velocity

Mitsos | 2022-03-06 09:58

You welcome!

trien | 2022-03-06 11:12