DWboutin Posted January 3, 2014 Share Posted January 3, 2014 Hi, I got my sprite, who is 58 x 74 and i set it body atthis.sprite.body.setSize(30, 63, 6, 11);It's a character, so when i press the left button i scale it at -1 in X. But i don't know how i can adjust the body size.There's a screenshot of both position, how can i adjust the left one? Thank you Link to comment Share on other sites More sharing options...
BitlasLT Posted January 3, 2014 Share Posted January 3, 2014 And why you are settings body for it?IF physic enabled, it should have body as sprite size square already.I guess if you want that particular size ,you can try to setSize of a body again ,with new x and ,y on -1 scale. Link to comment Share on other sites More sharing options...
@99golems Posted January 4, 2014 Share Posted January 4, 2014 sprite.body.x and sprite.body.y can be changed if you want. This probably isn't the best idea, as you can have your sprite's body teleport inside other collision bodies, and this isn't cool. A somewhat better way to do it (and what I usually do) is to center your sprite's image in the exact middle of the frame, so that way when you flip back and forth the body doesn't need to move at all. Cheers! BitlasLT 1 Link to comment Share on other sites More sharing options...
rich Posted January 4, 2014 Share Posted January 4, 2014 If you are scaling your sprite like this then I would do as 99golems said and anchor the sprite on 0.5, so the body will be relative to that. Link to comment Share on other sites More sharing options...
DWboutin Posted January 5, 2014 Author Share Posted January 5, 2014 Thank you for your answers! My anchor was already at 0.5, but my sprite wasn't really aligned with the middle. Thank you for your advices and sorry for my noobness Link to comment Share on other sites More sharing options...
Recommended Posts