CCTexture2D *tex = [[CCTextureCache sharedTextureCache] addImage:@"Flowers.png"]; CCSpriteBatchNode *batch; batch = [FrameAnimHelper animWithTexture:tex numFrames:20 //plist裡面的frame數量 plistFilename:@"Flowers.plist" //plist檔名 spriteName:@"Flower" //plist裡面的frame中的名字 spriteTag:FLOWERS_SPRITE_TAG]; //tag名稱 [self addChild:batch];
做好.png跟.plist放到Resources裡面就可以直接撥動畫了,
要注意的是frame數量跟名字不要寫錯,
還有這篇的類別中的檔名格式是"%@-%04d.png",
若plist有自己統一命名規則的話可以直接去修改類別內容
沒有留言:
張貼留言