From my experience, you will get nothing but problems if you make Area2D inherit Physics Body or vice versa.
My suggestion is that, make your hierarchy of nodes as follows:
Node2D
- Sprite2D
- KinematicBody2D
- - CollisionShape2D or CollisionPolygon2D
- Area2D
- -CollisionShape2D
Node2D
: Big Basket.
KinematicBody2D
: for moving Big Basket, use set_pos()
for parent node and move(0,0)
for Kinematic to detect collisions and block movement without really moving since the parent moved using transform. You can test for collision and don't process set_pos()
for parent if the KinematicBody2D
is_colliding()
Area2D
: for catching balloons or fruits.
Note: that on the signal Body Enter for the Area2D
, you have to test for and ignore the sibling KinematicBody2D
from being detected. It can be done simply by:
func _on_body_enter(body):
if (body.get_parent() == self):
return
... rest of code to collect balloons or fruit...
That is, if the script is assigned to the parent Node2D, and the signal connection is done to point to the script in Node2D.