What should I use instead of set.trigger function?

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

I’m trying to make my first game on godot, so I’m very inexperienced. It is a platformer. I’m following an old tutorial, where the set.trigger function was still present. Now, what should I use instead of it? The target is to make the player fall down when he touches the enemy. I created an area 2d with its collision shape, child of the player node, then in this 2d area I created the body entered signal connected with player. This would be the code:

func _on_Area2D2_body_entered(body):
if not alive: return

func dying():
if not alive: return
alive = false
velocity.y = -500

Could anyone help me? Thanks a lot

:bust_in_silhouette: Reply From: Inces

is trigger just a property of your Collision Shape ?
if yes, You can set it any of these ways :

get_node("Area2D2/CollisionShape2D").trigger = true



Yes, but it no longer exists. It was used so that the player would not collide anymore but simply fell down. I tried like this:

$Area2D2/CollisionShape2D.set_deferred(“disabled”, true)

But the player still collides at first and he still doesn’t fall down

frdeed | 2023-02-18 11:40

There is still plenty of options to disable collision. You can remove or change collision mask and layers, You can disconnect area entered signal, But the simplest is to set monitoring property of area to false

Inces | 2023-02-19 16:11

Yes okay. Now the problem is making him fall down when he touches the enemy To do this I was thinking of using an animation. But what x and y values should I set to make he fall vertically where he touches the enemy? Because earlier I created an animation for the coins, i.e. when the player touches them, they go up and disappear, but the coins stay still… Excuse me if I ask you some questions that may seem simple to you but as I told you it’s my first game… In the animation player is it possible to use the key only for the y value of the position and not both x and y?

frdeed | 2023-02-19 17:51