未找到SpriteBuilder图像文件 [英] SpriteBuilder image file not found
问题描述
我已经在Sprit构建器资源文件夹中添加了.png图像,并且已发布。
我看到sprite builder中的添加图像-IOS。
这里我试图通过以下方式访问添加的图片。
-
_hero.spriteFrame = [CCSpriteFrame frameWithImageNamed:@Down.png];
-
[_ hero setTexture:[CCTexture textureWithFile:@Game / Down.png]]
b $ b
但是这些方法都没有工作。
它会在日志中显示错误。
- [CCFileUtils fullPathForFilename :contentScale:]:cocos2d:警告:找不到文件:Down.png
请帮助我
更改 @Down.png
code>到
@Resources / Down.png
,因为您必须包含SpriteBuilder中创建的文件夹,用于引用由SpriteBuilder管理的资源文件。 p> 同样,如果你在名为Levels的子文件夹中有some.ccb,你必须加载字符串 @ Levels / some.ccb
。
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.
_hero.spriteFrame = [CCSpriteFrame frameWithImageNamed:@"Down.png"];
[_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.
Change @"Down.png
" to @"Resources/Down.png"
because you have to include the folders created in SpriteBuilder for any references to resource files managed by SpriteBuilder.
Likewise if you had some.ccb in a subfolder named "Levels" you'd have to load it with the string @"Levels/some.ccb"
.
这篇关于未找到SpriteBuilder图像文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!