var image = cc.Sprite.create(“ball.png”);
image.setPosition(500,500);
image.setContentSize(cc.size(500,500));
The “setContentSize()” in cc.Sprite class doesn’t change the width and height of the image.
Instead it only changes the position of the image on screen.
Is this a bug or the functionality /meaning is different.
Hi, contentsize refers to the original size, if you want to resize the sprite, use setScale() instead
But, if I want to reuse the CCSprite, as changing a texture.
I know setTexture will do the job, but if the new texture’s size is different from the original one, after setTexture the sprite node was looked freak.
I want to set the size of a Sprite to a fixed pixel width/height. It seems like the method to do that doesn’t exist, but we have setScale. Is the following the best approach to setting the size of a Sprite to fixed pixel dimensions or is there a better way? It seems works, but it seems like a hack and I feel like I’m missing some more straightforward way of doing this.