2015-06-21 86 views
0

我有這個SKAction序列:是否可以在不是SKAction的SKAction序列中運行代碼?

func move(){ 

    let recursive = SKAction.sequence([ 
     SKAction.moveByX(frame.size.width/2.8, y: 0, duration: NSTimeInterval(randomNumber())), 
     SKAction.moveByX(-frame.size.width/2.8, y: 0, duration: NSTimeInterval(randomNumber())), 
     SKAction.runBlock({self.move()})]) 
     doc.runAction(recursive, withKey: "move") 
} 

當這部分下方運行,我想改變我的節點的紋理屬性,但我無法弄清楚如何添加到SKAction序列。

SKAction.moveByX(frame.size.width/2.8, y: 0, duration: NSTimeInterval(randomNumber())) 

回答

3

你可以添加另一個runBlock調用嗎?

SKAction.runBlock(
{ 
     //change the texture and whatever else you need here... 
     doc.texture = someNewTexture; 
})