我试图在SK / SWIFT中“脉冲”一个精灵.我尝试使用For循环和.setScale是粗略的,但它们没有工作(没有错误 – 只是没有动画).我觉得使用SKActions可能会更优雅. 在使用下面的帮助后,这是我目
在使用下面的帮助后,这是我目前的实施.但是,它出现了编译错误;
Expected member name or constructor call after type name &
Consecutive statement on a line must be separated by a ;
这是我正在使用的代码:
SKAction *pulseUp = [SKAction.scaleTo(3.0, duration: 3.0)] SKAction *pulseDown = [SKAction.scaleTo(1.0, duration: 3.0)] SKAction *pulse = [SKAction.sequence(pulseUp, pulseDown)] SKAction *repeat = [SKAction repeatActionForever:pulse]] [self.playButton runAction: repeat]
任何帮助将不胜感激.
在带有Swift的xCode版本8.3.3中,let pulseUp = SKAction.scale(to: 3.0, duration: 1.0) let pulseDown = SKAction.scale(to: 0.5, duration: 1.0) let pulse = SKAction.sequence([pulseUp, pulseDown]) let repeatPulse = SKAction.repeatForever(pulse) self.playButton.run(repeatPulse)