How do I make Sonic trigger an animation when he hits an Area2D? #330
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
|
The Player scene already has an animation player.. why not use that instead? It can be like: Also, instead of checking the name of the node, you can define the function like that: Btw, are you sure that you set the Area2D's collision mask to be the same as the player's collision layer? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.







1 - make sure your collision callback function is actually running. Put a print statement at the beginning of it and make sure it gets logged.
2 - I say this because I don't see the little icon on your editor that indicates that you properly wired the signal to your callback function. For comparison sake, this is how the one for the boss boundary setting collision appears:
Notice the little green arrow and box thing on the top left. That indicates that this function is called back via a signal. You need to manually configure the collision box to point at that function in the node inspector right here.
Notice that the body_entered signal for Area2D shows the same icon from before here.
I…