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

gdscript: how can i create Gravity for the jump??? (KinematicBody2D)

:bust_in_silhouette: Reply From: NotGoodatGodot

you can use (your velocity variable).y += (your gravity constant)

where, in func _physics_process(delta). or where??

ManiCus | 2020-04-11 17:59

in func _physics_process(delta)

NotGoodatGodot | 2020-04-11 18:44

:bust_in_silhouette: Reply From: njamster

Take a look at the platformer-demo, especially Actor.gd and Player.gd. The idea is not different from other movement: you move the character each frame along a velocity-vector, so if you want your character to fall down, you just have to change the orientation of that vector. It’s usually done by adding a certain weight (the gravity) to the y-direction of your velocity-vector each frame, so the character will fall faster and faster the longer it is in free fall.