无法从spritebuilder显示场景或精灵

时间:2023-01-22 23:22:22

I followed the quickstart tutorial and a couple others but can't find why my new image and scene can't display after the initial scene.

我按照快速入门教程和其他几个教程,但无法找到为什么我的新图像和场景在初始场景后无法显示。

class MainScene : CCNode {
 var newMenu = CCNode()
 var newSprite = CCNode()

 override init() {
  super.init()
  newMenu = CCBReader.load("ccbResources/NewMenu")
  newSprite = CCBReader.load("ccbResources/NewSprite")
  newSprite.position = CGPoint(x: 229, y:30)
}
}

I created a custom class for NewMenu and NewSprite in Spritebuilder. After publishing and running in xcode neither the menu or sprite show up. I know that newMenu is loading because I created a class NewMenu that logs a message when the ccbResource is loaded just like the tutorial said to do.

我在Spritebuilder中为NewMenu和NewSprite创建了一个自定义类。在xcode中发布和运行后,菜单或精灵都没有显示出来。我知道newMenu正在加载,因为我创建了一个类NewMenu,它在加载ccbResource时记录消息,就像教程所说的那样。

1 个解决方案

#1


I'm not familiar with swift, however I think this should be like this

我不熟悉swift,但我认为这应该是这样的

newSprite = CCBReader.load("ccbResources/NewSprite.png")

.png or whatever file you load.

.png或您加载的任何文件。

#1


I'm not familiar with swift, however I think this should be like this

我不熟悉swift,但我认为这应该是这样的

newSprite = CCBReader.load("ccbResources/NewSprite.png")

.png or whatever file you load.

.png或您加载的任何文件。