簡體   English   中英

SKAction.wait導致調用錯誤中的額外參數

[英]SKAction.wait causing Extra Argument in Call Error

我正在嘗試對文本標簽進行動畫處理和編碼,但是使用SKAction.wait(:)函數會在調用錯誤中引起額外的參數。 這是我的代碼。 我沒有其他錯誤,我的其他SKAction函數運行正常:

import SpriteKit
import GameplayKit

class GameScene: SKScene {

    private var label : SKLabelNode?


    override func didMove(to view: SKView) {

        // Get label node from scene and store it for use later
        self.label = self.childNode(withName: "//helloLabel") as? SKLabelNode
        if let label = self.label {
            label.alpha = 0.0
            label.run(SKAction.fadeIn(withDuration: 2.0))

            var animateList = SKAction.sequence(SKAction.fadeIn(withDuration: 1.0), SKAction.wait(forDuration: 2.0), SKAction.fadeOut(withDuration: 1.0))

        }
    }
}

SKAction.sequence將數組作為參數。 因此,您的陳述應如下

var animateList = SKAction.sequence([SKAction.fadeIn(withDuration: 1.0), SKAction.wait(forDuration: 2.0), SKAction.fadeOut(withDuration: 1.0)])

在這里更多細節

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM