【发布时间】:2016-09-27 05:47:13
【问题描述】:
我不明白出了什么问题。我的代码已编译,代码中没有错误和问题,终端中没有消息,图集由 .png 图像组成。 所以,当我编译我的代码时,纹理不显示。我能看到的只有红十字。我该如何解决这个问题?
这是我的代码:
import SpriteKit
class GameScene: SKScene {
override func didMoveToView(view: SKView) {
self.backgroundColor = UIColor(red: 0.4, green: 0.6, blue: 0.5, alpha: 1.0)
let bee = SKSpriteNode()
bee.position = CGPoint(x: 250, y: 250)
bee.size = CGSize(width: 40, height: 40)
self.addChild(bee)
let beeAtlas = SKTextureAtlas(named: "bee")
let beeFrames : [SKTexture] =
[beeAtlas.textureNamed("c1.png"),
beeAtlas.textureNamed("c2.png")]
let flyAction = SKAction.animateWithTextures(beeFrames, timePerFrame: 0.5)
let beeAction = SKAction.repeatActionForever(flyAction)
bee.runAction(beeAction)
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
}
}
【问题讨论】:
标签: ios xcode swift sprite-kit