Search code examples
cocos2d-x

resize sprite with image (cocos2dx)


I know I can use

sprite.runAction and cc.ScaleTo

to zoom in or zoom out a sprite with image, in which the width/height rate are same.

But I hope to change the width/height rate and resize/resample a sprite.

Is it possible?

Your comment welcome


Solution

  • Use the CCScaleTo initializer where you can specify x/y components individually, for example:

    [CCScaleTo actionWithDuration:2 scaleX:4 scaleY:-2];