未找到SpriteBuilder图像文件 [英] SpriteBuilder image file not found

查看:159
本文介绍了未找到SpriteBuilder图像文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Sprit构建器资源文件夹中添加了.png图像,并且已发布。



我看到sprite builder中的添加图像-IOS。



这里我试图通过以下方式访问添加的图片。




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


  2. [_ 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.

  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.

解决方案

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆