For my 2D RPG game, I’m trying to figure out the simplest way of coding a pot to break after the player attacks it by releasing an invisible hitbox so the pot can detect the hit.
The player’s hit boxes all have 2D polygon colliders and they appear during the player’s attack animations.
In Playmaker, the Pot’s FSM has an Idle state where if a Collision2D event occurs with an object with the tag “Hitbox”, it should send the event “Smash” and go to the “Destroy” state.
The Destroy state includes:
“Destroy Self”
“Create Object (Explosion Particles)”
“Destroy Object (Explosion Particles) [Delay 1]”
The problem is, when the player attacks the pot, nothing happens. The Pot’s FSM never goes to the “Destroy” state.
I tried adding “RigidBody2D” (Dynamic with gravity scale at 0) to all the Hit boxes and marked the pot as a trigger in ‘Box Collider 2D’, but still no luck.
How come the code isn’t working? Any help would be appreciated.
Thanks.