0 votes

I am creating a breakout style game

I have a paddle that is a RigidBody2d in static mode it haves the body_entered(body) function

Also i have a powerup, it is the other RigidBody2d and it slides down but when it collides with the paddle the paddle doesnt detect that the body entered, it doesnt even detect other nodes

The layer mask are correct also.

in Engine by (22 points)

1 Answer

0 votes

Place an Area2D node on the powerup. I presume you are using the 2D Editor, so I will be using that as my example. Using the "body entered" function, connect it by doing it in the inspector or use the line:

$Area2D.connect("body_entered", self, "bodyEntered")

Before you play the game, make sure you have made the player in a certain group. If this case, I will be using the group name "Player".

Your function should look something like this (I will be using the code above):

func bodyEntered(body):
    if body.is_in_group() == "Player":
        # Do Code
by (163 points)

Hello Thanks for answering

Yesterday i fixed it changing the player mode to "Kinematic" dont know why it worked

I will try doing what you tell me as they look like best practices, will tell you my results

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 Frequently asked questions and 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 [email protected] with your username.