Can't figure out how to add a fastfall to a 2d platformer

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

I’m a complete beginner trying to learn Godot and was trying to make a small little 2d platformer (I almost completely stole the code from heartbeasts tutorial) but with his code there was’t a way to fastfall which I tried to add and did miserably.

enter code here
extends KinematicBody2D

const UP = Vector2(0, -1)
const GRAVITY = 15
const SPEED = 200
const JUMP_HEIGHT = -500

var motion = Vector2()

func _physics_process(delta):
motion.y += GRAVITY

if Input.is_action_pressed("ui_right"):
	motion.x = SPEED
if Input.is_action_pressed("ui_down"):
	motion.y += 35
if Input.is_action_pressed("ui_left"):
	motion.x = -SPEED
else:
	motion.x = 0
	
if is_on_floor():
	if Input.is_action_just_pressed("ui_up"):
		motion.y = JUMP_HEIGHT

motion = move_and_slide(motion, UP)``
:bust_in_silhouette: Reply From: Dooowy.

The type Const can’t be changed once the variable is loaded in the engine. Change the types to var.

Your fastfall code simply adds its motion to Gravity while it should

var AffectedLength = 0;

func physicsprocess(delta):
AffectedLength = AffectedLength + 1
motion.y = motion.y + GRAVITY^(AffectedLength*0.1)

Im a C# programmer so try this.