Two different players enter Area2D

FrasseFrasse Posts: 4Member

I have two players. Player1 and Player2. (both are KinematicBodies2D).
I also have a Area2D.

I want that when Player1 enters the Area2D then make the sprite not visible.
(Sprite name: g1 ($g1.visible = not $g1.visible)).
And when Player2 enters the Area2D then make the sprite not visible.
(Sprite name: g2 ($g2.visible = not $g2.visible)).

And I have connected Area2D node signal on function "body_entered" with both player1 and player2.
So my problem is how to make that when Player1 enter the Area2D then send signal to player1 code AND NOT player2. And when player2 enter the Area2D then send signa to only player2 code and not player1.

Please help.

I have been stuck in many days.

Here are pictures on Player1 code, Player2 code, Area2D code and signals.


  • TwistedTwiglegTwistedTwigleg Posts: 3,525Admin

    Please do not make another post asking the same question. Technically this could be considered spam, which is against forum rules. If you have additional details to add to a question, please just post them on the first, original forum post.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file