Sprite not rotating around its centre after Scaling at its centre

Posted by asma.farhat on Game Development See other posts from Game Development or by asma.farhat
Published on 2013-04-23T14:24:46Z Indexed on 2013/07/03 17:21 UTC
Read the original article Hit count: 329

Filed under:
|
|

If I scale a sprite at its centre, then try to rotate it around its centre as well, the rotation does not occur around its centre.

If you need to rotate, for example a scaled ball,the way its working it is set the scale center at the top left (0,0) set the scale that you want, and then set the rotation center to the middle of the scaled sprite, and then apply the rotation modifier.

blaBloBliSprite.setScaleCenter(0, 0);
blaBloBliSprite.setScale(0.667f);
blaBloBliSprite.setPosition(557, CAMERA_HEIGHT / 2 - blaBloBliSprite.getHeightScaled() / 2);
blaBloBliSprite.setRotationCenter(blaBloBliSprite.getWidthScaled() / 2, blaBloBliSprite.getHeightScaled() / 2);

But I want to scale a sprite at its centre as well.

Is there any way of doing it?

© Game Development or respective owner

Related posts about sprites

Related posts about rotation