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

php - How to pass multiple values from url -

php - Laravel not returning controller -

c# - Confused on how to specify a Platform and Version while using ChromeOptions for RemoteWebDriver with Selenium donNet since recent updates -