2

I have added a .png image in sprit builder resource folder and I have published it.

I see the added image in sprite builder all folder in Resources under Published-IOS.

Here I have tried to access the added image in following ways.

enter image description here

  1. _hero.spriteFrame = [CCSpriteFrame frameWithImageNamed:@"Down.png"];

  2. [_hero setTexture:[CCTexture textureWithFile:@"Game/Down.png"]]

But none of these methods are working.

it show error in log as.

 -[CCFileUtils fullPathForFilename:contentScale:] : cocos2d: Warning: File not found: Down.png

Please help me with this to resolve.Am a newbie using this sprit builder.

4

1 回答 1

4

将 "更改@"Down.png为,@"Resources/Down.png"因为您必须包含在 SpriteBuilder 中创建的文件夹,以供对 SpriteBuilder 管理的资源文件的任何引用。

同样,如果您在名为“Levels”的子文件夹中有 some.ccb,则必须使用 string 加载它@"Levels/some.ccb"

于 2014-06-26T12:19:54.000 回答