I am attempting to "pulse" a sprite in SK/SWIFT. My attempts were crude using For-loops and .setScale, but they were not working (no errors - just no animation). I feel that using SKActions would perhaps be more elegant.
After using some help from below here is my current implementation. However, it is coming up with compile errors;
Expected member name or constructor call after type name & Consecutive statement on a line must be separated by a ;
Here is the code I am using:
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]
Any help would be greatly appreciated.
In xCode Version 8.3.3 with Swift,
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With