简体   繁体   English

在SKAction中更改变量的值

[英]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? 我试图在SKAction中更改变量的值,但是它没有用,现在我想知道是否有可能,如果可以,怎么办?

Thank you for your answers 谢谢您的回答

Yes you can do that, you will set up an SKAction to run a block like so: 是的,您可以这样做,您将设置一个SKAction来运行如下代码:

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

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

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