What I am trying to accomplish is if an my object collides with something I would like to check and see what the collision is, then if it is a specific actor I want to check what animation is playing on that actor. I am unsure how to get the actor from the collision. see example below for what I have right now.
if (Sup.ArcadePhysics2D.collides(this.actor.arcadeBody2D, Sup.getActor("collision").arcadeBody2D) {
if (Sup.getActor("collision").spriteRenderer.getAnimation() == "animation1") {
//do something...
}
}
After this step I am going to make a generic function so I can do whatever I want without needing to put this code everywhere. Something like:
collidesWith(target, animation) {
if (target.getAnimation() == animation) {
//do something..
}
}
My current issue is I don't know the proper way to get the actor that was involved in the collision. For example if a car collides with a wall how can I reference that wall's actor with a collision script inside of the car?
I had posted this on Reddit too, I will update either posting with the working response.