How do I make an AnimatedSprite with several collision zones trigger each zone a different event?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By WuaUP

How do I make an AnimatedSprite with several collision zones trigger each zone a different event?

And also get the object that has collided with that collision zone

I also need some collision zones to superimpose, triggering both collision zones

For a single collision zone it is easy and it works. The problem for me to have is several zones each with its own trigger of method

A link could help me, but I only find links for a single collision zone

Thanks for the patience, I’m new to Godot

:bust_in_silhouette: Reply From: ProXFox

make more than one area/staticbody/kinematicbody with different names and make a code like this
func on_hit(node):

if node.getparent().name == NODE_YOU_WANT_TO_HIT_WITH:

if node.name == area_you_want_to_hit:

things_you_want_to_do

if node.name == another_area_you_want_to_hit:

things_you_want_to_do

if node.name == third_area_you_want_to_hit:

things_you_want_to_do