所以我有我的场景呈现,并且当我按下按钮时我正在尝试显示一个精灵。我知道函数是因为NSLog调用的,但我无法显示精灵。
func ShowShip() {
var booster = CCBReader.load("ccbResources/Booster")
booster.position = CGPoint(x: 0, y: 0)
self.addChild(booster)
NSLog("created sprite")
}
调用日志但不显示精灵。我查看了快速入门教程,看不出太大差异。
编辑:尝试直接调用.png资源但是出现了解包错误
答案 0 :(得分:0)
尝试直接方法:
// method_1:从磁盘读取图像
ng-repeat
// method_2:从精灵表中读取图像
var booster = CCSprite(imageNamed:"Booster.png")
booster.position = CGPoint(x: 50, y: 50)
self.addChild(booster, z:3)