How to make a area 2D with collision shape detect another collision shape entering it ??

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

I have this Space ship and i want it to reach a point and when it reaches, a panel with a text should show a text YOU WIN but the problem is i dont know how to make a area 2D detect the SpaceShip(kinematicBody2D) and show the text

both have collision shapes

i already have all the nodes ready but im lacking the information to make one react to another

i have just one script code, the 8 way movement of the tutorial

:bust_in_silhouette: Reply From: Catusfelony

You’ll need to connect a body_entered signal from the Area2D to the KinematicBody2D.

You can do that by accessing the “Node” tab when the Area2D is selected

Node tab

From there, you right click the body_entered signal and then “Connect”

Right clicking the body_entered signal

After that, a dialogue box will appear, wherein you can select the SpaceShip node

Connect Signal dialogue box

Clicking “Connect” button on the bottom will create a new function, in this new function you can do whatever you need pertaining to the victory state.

Function that executes when the spaceship and the area meet


HelpMePlease | 2019-11-10 19:59