![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | semperfoo |
Hi, guys! First of all, I’m not really sure if what I’m doing is the best way of approach a problem like this. I’m a game designer, not really a programer.
I’m trying to make a “Catch words” game. This is my layout: https://i.imgur.com/30ChRWZ.png
Each Label has a script that sorts a random letter if I don’t define one in the editor. I want the player to click on the first letter, and release at the last one.
I draw a line following the mouse cursor while the button is pressed. Once player release, it snaps to the center of the nearest Label.
My problem is:
I need to catch every letter under this line.
As Raycast just would return the first object, I added a Area2D and area_entered signals to each Label and to the line Area2D to check the overlapped Labels and make an array, but the f*cking get_overlaping_areas function just throw an empty array on my face.
I’m searching for similar situations for the last four days, but no solution. I have used a SegmentShape2D as a shape. When I print it’s A and B points they correctly match the Labels origin, so I assume the shape change as expected, but still no result on check what it is overlaping.
But what is really killing me is that if I push the Collision shape points over the container in editor, when I run it both get_overlaping_areas return the array and the signals trigger perfectly fml!
This is a list of what I’ve tried (attempt : result):
- get_overlaping_areas : empty array
- Clear and create another shape owner, add shape etc : empty array
- something with direct space and physics query : bananas
I’m new to this forum, hope I give enough infos.
Thank you, people!