Making sprites disappear when colliding with another sprite

Godot Version

Godot 4


I’m trying to have my 2D sprites disappear as they hit another sprite below it…example: Having a raindrop physically fall from the top and be caught in a movable bucket on the bottom.
When my sprite drops from the top of my screen, it continues off the page instead of being collected by the object below it. Is there a fix for this? I’m a total newbie and need thorough directions (visuals are even better)
Also does anyone have any knowledge about making a scoreboard??

Hi, so I would recommend using an area2D for at least one of the things(in terms of your example, the bucket or raindrop). Then you can connect the on_body_entered signal to a script using the nodes tab on the inspector when you click on the area2d in the tree. I also think that if you’re using a 2d node, you can set it to invisible using the following code.

func on_body_entered(body):

The Area 2D node, and on_body_entered signal is the way to go.
-Make sure your raindrop has an AreaNode2D with child CollisionShape2D
-connect Area node body_entered signal to a func _on_body_entered(body) in it’s script
-check if the buckets collider enters the areanode2d, then set the raindrops velocity or speed to 0
-you can also reparent the raindrop to the bucket’s collider, after it stops moving, so it’ll move with the bucket automatically if you need.

# put this script on the AreaNode2D
# make variables, if you want to reparent the raindrop after stopping it's movement
var raindrop = get_parent() 
var bucketNode = root.get_node("Path/To/BucketNode")

# AreaNode2D collision detection
func _on_body_entered(body):

	if body.is_named("bucket"):
		raindrop.velocity = 0