简体   繁体   English

SKAction.wait导致调用错误中的额外参数

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

I am attempting to animate and code a text label, however using the SKAction.wait(:) function causes an extra argument in call error. 我正在尝试对文本标签进行动画处理和编码,但是使用SKAction.wait(:)函数会在调用错误中引起额外的参数。 Here is my code. 这是我的代码。 I have no other errors, and my other SKAction functions are working fine: 我没有其他错误,我的其他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 takes in an array as an argument. SKAction.sequence将数组作为参数。 So your statement should read as follows 因此,您的陈述应如下

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

More details here 在这里更多细节

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM