图像不显示从纹理打包器spritesheets

时间:2013-06-26 20:07:32

标签: cocos2d-iphone ccsprite texturepacker ccspritebatchnode

很抱歉,这听起来很简单。我使用Texture Packer从Ray Wenderlich的网站上关注making spritesheets的教程。代码似乎运行没有错误,但没有显示精灵。这是一个示例:

-(id)initWithGameLayer: (HelloWorldLayer *)thelayer{
if (self = [super init]) {

    //winSize = [CCDirector sharedDirector].winSize;
    gameLayer = thelayer;
    hasSwitched = YES;
    transitionArray = [[NSMutableArray alloc] init];

    backgroundBatchNode = [CCSpriteBatchNode batchNodeWithFile:@"testbg.png"];
    [self addChild:backgroundBatchNode];
    [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"testbg.plist"];


    bg1 = [CCSprite spriteWithSpriteFrameName:@"background01.png"];
    bg1.position = ccp(WIDTH/2,HEIGHT/2);
    [backgroundBatchNode addChild:bg1 z:0 tag:2];

    bg2 = [CCSprite spriteWithSpriteFrameName:@"background02.png"];
    bg2.position = ccp(WIDTH/2,HEIGHT/2 + HEIGHT);
    [backgroundBatchNode addChild: bg2 z:0 tag:3];


   }
   return self;
}

0 个答案:

没有答案