Pregunta

I've recently switched from Cocos2D to Sprite Kit. But I've come across an annoying problem. Any image added to an SKScene is doubled in size. I do exactly the same thing both in Sprite Kit and Cocos2d. Here's Cococs2D version:

CCSprite *sprite=[CCSprite spriteWithFile:@"w64.png"];
sprite.position=CGPointMake(100.0,100.0);
[self addChild:sprite];// self is a CCScene

and here's the Sprite Kit version:

SKSpriteNode *sprite=[SKSpriteNode spriteNodeWithImageNamed:@"w64.png"];
sprite.position=CGPointMake(100.0,100.0);
[self addChild:sprite];// self is an SKScene

In the first case I get the image with its actual size but in the second case the sizes are doubled, both width and height. I don't scale anything anywhere. I have tried all available SKSceneScaleMode options, none of them help

¿Fue útil?

Solución

Ahh, the problem was indeed with the naming of the images as @Dobroucudni Tapir said. As I mentioned before, it didn't help at first. But I tried cleaning the project and it worked. Now I wonder why I have to suffix my images in Sprite Kit while I don't have to do so in Cocos2D. What if my application is for retina displays only?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top