c++ - Cocos2d-x setScaleX() -



c++ - Cocos2d-x setScaleX() -

so programming game in cocos2d-x , need 1 of sprites wider amount of time, tried method setscalex(). problem content size of sprite not change, , since collision scheme based on content size of sprite, not work. here code utilize scaling:

bar = sprite::create( "bar.png" ); cclog("size: %f,%f.", bar->getcontentsize().width, bar->getcontentsize().height); bar->setscalex(1.5); cclog("size: %f,%f.", bar->getcontentsize().width, bar->getcontentsize().height);

the output same on both cases. there way of fixing this?

contentsize represent original texture size unless set using setcontentsize method.

you can either multiply size scale factor or utilize boundingbox().size know current size of scaled sprite(if not rotated or skewed).

c++ cocos2d-x

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -