0

I have this SKAction sequence:

    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")
}

When this part below runs, I want to change the texture property of my node, but I can't figure out how to add that into the SKAction sequence.

SKAction.moveByX(frame.size.width/2.8, y: 0, duration: NSTimeInterval(randomNumber()))
NickyNick321
  • 213
  • 1
  • 4
  • 12

1 Answers1

3

Can you add another runBlock call?

SKAction.runBlock(
{ 
      //change the texture and whatever else you need here...
      doc.texture = someNewTexture;
})
Thunk
  • 4,099
  • 7
  • 28
  • 47