简体   繁体   中英

Changing the value of a variable in an SKAction

I've tried to change the value of an variable in an SKAction but it did not work and now I want to know if it is possible and if yes then how?

Thank you for your answers

Yes you can do that, you will set up an SKAction to run a block like so:

let anAction = SKAction.runBlock {
    myVariable += 10
}
someNode.runAction(anAction)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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