[英]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.