And as it said i couldn’t see “body” used in this function/signal. However if i remove the “body” parameter collisions are no longer detected in the game.
Where is the “body” parameter being used?
Also where does “body” get its value(s) from?
Thanks.
So if I understand the physics object is passed with the signal and becomes the “body” parameter.
I’m not trying to get rid of the warning I was just trying to figure out why “body” is needed in the function parameter for the game to work when there is no place in the function it is used.
I would have thought since “body” isn’t used in the function i could have defined the function without “body” like so.
func _on_body_entered():
However since this makes the game not detect collisions the “body” parameter must be needed by something that is not seen in the script right?
Because you can’t add or remove parameters of a signal that’s already implemented. You have to connect a method with the same signature.
“body” is the Node that enters the Area2D. In general, collisions are there to detect other objects and do something with that object, or get information from that object to do something to the Player. If your game doesn’t do any of that, that’s fine, just rename the parameter to _body to avoid the warning.
The warning is useful, because in general you’re supposed to use the body parameter, so it’s likely you forgot to use it and the game warns you about it.