0 votes

hello. i'm using godot 3, and got a problem, i want to make "breakout" game. but there's a problem. paddle have 3 area2d, one for left, one for right, one for middle. i want ball to do something else when he collides with one of these. i did it but there's a problem, some times ball hit them in the same time, and codes for two different area2d's happen. how can i fix this? i want it to when it hits 2 area2d at the same one of their code happen, a random one of them, or the area2d's has more collision area.
game files: https://ufile.io/tut86

in Engine by (82 points)

Looks like I have similar problem as you. My topic here https://godotengine.org/qa/37883/manipulate-signals-execution-order-enter-diffrent-areas2d (still unanswered).

For your case you can try to add some bool flags. For example:
make bool leftareaentered = false
in onbodyentered() from leftarea set leftareaentered to true (and to false onbodyexited()), and then in your center area onbodyentered() start the code with
if ! left

Make same for other areas, and now only one area can be processed at once (randomly)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.