SKAction动画不适用于SKSpriteNode

时间:2017-08-07 15:30:49

标签: ios swift3 sprite-kit skspritenode skaction

我有一些动画启动屏幕的代码,但是,在运行时,启动屏幕根本不做任何事情。这是我的代码:

import SpriteKit
import GameplayKit

class GameScene: SKScene {

let fadeOut = SKAction.fadeOut(withDuration:2)
let fadeIn = SKAction.fadeIn(withDuration: 2)

override func didMove(to view: SKView) {

    let startScreen = SKSpriteNode()
    startScreen.self.childNode(withName: "startScreen")

    startScreen.run(fadeOut) {
        startScreen.texture = SKTexture(imageNamed:"pong")
    }

    startScreen.run(fadeIn)

    startScreen.run(fadeOut) {
        startScreen.alpha = 0.0
        startScreen.zPosition = -2
    }

}
}

0 个答案:

没有答案