gpt4 book ai didi

ios - 找不到 SpriteBuilder 图像文件

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:42:53 26 4
gpt4 key购买 nike

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

我在 Published-IOS 下 Resources 的 all 文件夹中看到添加的图像。

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

enter image description here

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

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

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

它在日志中显示错误。

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

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

最佳答案

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

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

关于ios - 找不到 SpriteBuilder 图像文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24410157/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com