+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

asked May 27, 2018 in Engine by WuaUP (19 points)

1 Answer

–1 vote

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

answered Dec 12, 2018 by ProXFox (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 How to use this Q&A? before posting your first questions.