Best way to animate sprite with collisionobject that moves?

Think of something like Hollow Knight. It’s a spritesheet used to animate the player doing things like sliding or swinging a nail. As the nail swings the collisionobject has to move along with the spritesheet changes to register any hits the nail contacts.

What is the best way do achieve this in defold? And are there any examples out there?
Also as a character may slide the hotbox changes size along with the spritesheet changes. Some game a character can transform their body to skinnier as it slides, so those frames will need to have the collisionobject changed to match the skinnier body.

Thank you

I haven’t made a game in Defold like this, but I believe normally you do not reposition collision shapes; you enable and disable them in your animation.

Believe it or not, sword swings or other round moves use flashing boxes, maybe more than one in sequence. Axis-aligned boxes are the most efficient overlap detection by far. :slightly_smiling_face:

1 Like

I figured that was what it was. So I make all my collisionobjects and then enable and disable them as the image changes.

I guess this is why people use spine models. LOL.