未找到 SpriteBuilder 图像文件

SpriteBuilder image file not found(未找到 SpriteBuilder 图像文件)

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

问题描述

我在 sprit builder 资源文件夹中添加了一个 .png 图像并已发布.

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

我在 Published-IOS 下的 Resources 中的 sprite builder 所有文件夹中看到添加的图像.

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"];

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

但是这些方法都不起作用.

But none of these methods are working.

它在日志中显示错误.

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

请帮我解决这个问题.我是使用此 sprit builder 的新手.

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

推荐答案

@"Down.png" 改成 @"Resources/Down.png" 因为你有包括在 SpriteBuilder 中创建的文件夹,用于对 SpriteBuilder 管理的资源文件的任何引用.

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.

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

Likewise if you had some.ccb in a subfolder named "Levels" you'd have to load it with the string @"Levels/some.ccb".

这篇关于未找到 SpriteBuilder 图像文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:未找到 SpriteBuilder 图像文件

基础教程推荐