Hello,
I'm new to Godots physics engine; I wanted to make a game where everytime the player touches the screen the playerNode(a RigidBody2D) behaves like a StaticBody2D, otherwise the node should behave like a RigidBody2D.
My Code below doesn't work. When the screen gets touched the playerNode behaves like a StaticBody2D, but if I stop touching it doesn't change back to the RIGID_MODE-Behavior.
However, I can see in the console that the value of "mode" changes as wanted, but still theres no gravity or so that gets applied.
My Code
func _physics_process(delta):
if (Input.is_action_just_pressed("touch")):
mode = MODE_STATIC
if Input.is_action_just_released("touch"):
mode = MODE_RIGID
print(mode);
What makes it even more confusing is that if I switch mode = MODESTATIC and mode = MODERIGID it works, but not the other way around.