How to change shape when changing sprites?

Nov 29, 2010 at 7:26 AM

Hello guys,

Now I'm working on a sprite sheet, and each of sprites has different size, for example, crawl and run contains different height.

I've already defined shapes of every sprites in the sprite sheet. However, it seems that the fixture doesn't allow me to change its shape. It says changing vertices could affect some collision cache things.

My question is, is there any solution to change shape of an object during the game, when the object's sprite is changed?

Thank you.

Nov 29, 2010 at 8:45 AM

I think the best solution here is to have different shapes for your character and activate/deactivate them as you need, instead of changing the shape. So this way you could have a rectangle when you character is standed, and a small square when crouched. If your character is standed, you deactivate the square and activate the rectangle, and the opposite when crouched.

Nov 29, 2010 at 8:58 AM

Or have a combination of shapes that actually resemble the movement (two squares, attached with a sliding joint, and move the upper one)

Regards,

Thorsten

Nov 29, 2010 at 9:32 AM
Pnikosis wrote:

I think the best solution here is to have different shapes for your character and activate/deactivate them as you need, instead of changing the shape. So this way you could have a rectangle when you character is standed, and a small square when crouched. If your character is standed, you deactivate the square and activate the rectangle, and the opposite when crouched.

Sorry, I could not understand what you mean by "activate/deactivate" shapes. Could you give me some examples?

Thanks.

Nov 29, 2010 at 11:02 AM
instinctvfx wrote:

Or have a combination of shapes that actually resemble the movement (two squares, attached with a sliding joint, and move the upper one)

Regards,

Thorsten

I'll give it a try, Thanks :)

Nov 29, 2010 at 11:22 AM
gudome wrote:
Pnikosis wrote:

I think the best solution here is to have different shapes for your character and activate/deactivate them as you need, instead of changing the shape. So this way you could have a rectangle when you character is standed, and a small square when crouched. If your character is standed, you deactivate the square and activate the rectangle, and the opposite when crouched.

Sorry, I could not understand what you mean by "activate/deactivate" shapes. Could you give me some examples?

Thanks.

I meant activate and deactivate the collisions :)