Falling Down!(My character problem!)

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

I have a kinematic body that in a platform game.when I hit space it jumps and move around with arrow key and when he is in the air.the gravity affect him by

velocity.y += gravity * delta

In the process(I mean physic one), the problem is when the character dies, I disable the process with
set_process(false). It works fine But when I’m in the air and someone kill me the character die and disable it’s process so the gravity doesn’t work and it remain in the air.What SHOULD I DO.

That was my first question the second is I want throw somethin like rope from character and attach it to wall(that is static body) and become suspend in the air(like hook in Terraria game).which node should I?

:bust_in_silhouette: Reply From: Magso

Q1 - I wouldn’t use set_process(false) unless it was for testing purposes or maybe in an editor tool. This would be a case of using if statements.

var alive = true
if alive:
elif !alive:

The death could also be done in a function called when the player has been killed.

if (what ever killed the player):

func death():
    alive = false

Q2 - For a rope look up joints, specifically the Generic6DOFJoint node.

Thanks. But Ive got another idea. When the player dies. I can say

If dead and $raycast_down. Is_coliding() :
     #Set_the process false

And for second question : can you tell me how to use
This node I don’t know it very well

Mk_ | 2020-03-01 23:40