ActionQ project on Github

12 10 2015

I’ve created a new project on github that allows users to add actions to a FIFO queue to be processed sequentially. I did this because it can be a huge pain to deal with calling multiple actions for multiple sprites, and coordinating what action happens when.  the ActionQ class allows you to easily throw SKActions into the queue and they will run in the order it was received into the queue.

Screen Shot 2015-10-11 at 11.54.05 PM

Make SpriteKit SKSpriteNode glow

3 10 2015

so you’re making your spritekit game, and you want the user to know they should click on a button, but you’re not sure what the best way to do this is. well you have come to the right place.  I’ve run into this issue and have tried a few methods and found a method that really looks cool and is easy to implement. the two basic steps are to copy the SKSpriteNode, place it directly on top of itself, and  change the blendMode to “add” this will make the entire node look like it is glowing. Now the secret sauce is to setup an SKAction loop to continually change the alpha of this new node from 0 to lets say 0.3. this will make a pulsing glow effect on your original skspritenode that looks really neat and is clear to the user that they should click it! here is the code, enjoy!

// this is our original node that we want to make glow
playButton.anchorPoint = CGPointMake(0.0, 0.0)

// create a copy of our original node create the glow effect
let glowNode : SKSpriteNode = playButton.copy() as! SKSpriteNode
glowNode.size = playButton.size
glowNode.position = CGPoint(x: 0, y: 0)
glowNode.anchorPoint = playButton.anchorPoint
glowNode.alpha = 0.5
glowNode.blendMode = SKBlendMode.Add

//create the skaction loop that fades in and out
let fadeOut = SKAction.fadeAlphaTo(0, duration: 1)
let fadeIn = SKAction.fadeAlphaTo(0.3, duration: 1)
let forever = SKAction.repeatActionForever(SKAction.sequence([fadeOut, fadeIn]))

// add the new node to the original node

// add the original node to the scene