+2 votes

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

in Engine by (19 points)

1 Answer

–2 votes

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

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

if node.name == areayouwanttohit:

thingsyouwanttodo

if node.name == anotherareayouwantto_hit:

thingsyouwanttodo

if node.name == thirdareayouwantto_hit:

thingsyouwanttodo

by (82 points)
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.