开发者

Question about cocos2d sprite sheets

What exactly are the 开发者_高级运维restrictions on sprite sheets? The API-reference says this:

A CCSPriteSheet can reference one and only one texture (one image file, one texture atlas).

Does that mean that i can use a big 512x512 texture with lots of sprites in it like for an animation, and still be able to use a sprite sheet to render that? Even though i might have several instances of the sprite that are on different frames of the animation?

I'm currently loading textures like this

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"fiends.plist"];

And assigning them like this

fiendSprite = [CCSprite spriteWithSpriteFrameName:spriteName];

Would i be able to draw those sprites using a sprite sheet instead even though different towers in the game are using different parts of the large texture??


As long as you make your sprites children of your sprite sheet you should be able to do this. There are plenty of examples on the cocos2d forums along these lines, here is a good post to get you a bit more info as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜