Gamescene没有名为“waitEvent”的成员错误

时间:2014-10-25 01:38:26

标签: ios swift sprite-kit

我目前正在学习Apple的新软件编程语言(Swift),我遇到了这个错误: Gamescene没有名为“waitEvent”的成员 如果有人知道为什么这可能请回复,这就变得非常令人沮丧。

这是在Swift和Sprite Kit中!

以下是代码:

override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
    /* Called when a touch begins */    

    for touch: AnyObject in touches {
        let location = touch.locationInNode(self)

        if (destroyerNode? != nil){
            destroyerNode!.position = location
            destroyerNode!.physicsBody?.velocity = CGVectorMake(0, 0)
            destroyerNode!.physicsBody?.dynamic = true

            let waitAction = SKAction.waitForDuration(2)
            destroyerNode!.runAction(waitAction, completion: {
                self.waitEvent()
                //there is an issue with someEvent
                }
            )
        }
        else{
            println("that destroyer was really not there")
        }
    }

    func waitEvent(){
        //make the destroyer a dynamic object
        destroyerNode!.makeBodyDynamic()
        println("The wait is up")
    }

    func update(currentTime: CFTimeInterval) {
        /* Called before each frame is rendered */
    }
}

0 个答案:

没有答案