How to add particle effects to an iOS App that is not a game using iOS 7 SpriteKit Particle?

Create a SKScene in your UIView to add a SKEmitterNode particle effect. One way of doing this: 1.In storyboard (or programatically if you prefer) add a View object on top of the existing View and resize it to your needs. 2.Change the class of the new view to SKView 3.In your view controller .h file … Read more

How to create the effect of a circular object entering and separating from a thick substance

You are looking for a fluid simulator This is indeed possible with modern hardware. Let’s have a look at what we are going to build here. Components In order to achieve that we’ll need to create several molecules having a physics body and a blurred image use a Shader to apply a common color to … Read more

Performing your own physics calculations for a collision in Sprite Kit

I’m trying to set up some elastic collisions using Sprite Kit I think you’re misunderstanding the physics in play here. An elastic collision is an oversimplification of a collision. In reality, no collision results in a perfect transfer of energy. I’ve explained the physics here in an answer to the related question you linked to. … Read more

How to draw a line in Sprite-kit

Using SKShapeNode you can draw line or any shape. SKShapeNode *yourline = [SKShapeNode node]; CGMutablePathRef pathToDraw = CGPathCreateMutable(); CGPathMoveToPoint(pathToDraw, NULL, 100.0, 100.0); CGPathAddLineToPoint(pathToDraw, NULL, 50.0, 50.0); yourline.path = pathToDraw; [yourline setStrokeColor:[SKColor redColor]]; [self addChild:yourline]; Equivalent for Swift 4: var yourline = SKShapeNode() var pathToDraw = CGMutablePath() pathToDraw.move(to: CGPoint(x: 100.0, y: 100.0)) pathToDraw.addLine(to: CGPoint(x: 50.0, y: … Read more

How do I detect if an SKSpriteNode has been touched

First set the name property of the SKSpriteNode to a string. pineapple.name = “pineapple” pineapple.userInteractionEnabled = false then in touchesBegan function in the Scene override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { let touch:UITouch = touches.anyObject()! as UITouch let positionInScene = touch.locationInNode(self) let touchedNode = self.nodeAtPoint(positionInScene) if let name = touchedNode.name { if name == … Read more

Swift – Must call a designated initializer of the superclass SKSpriteNode error

init(texture: SKTexture!, color: UIColor!, size: CGSize) is the only designated initializer in the SKSpriteNode class, the rest are all convenience initializers, so you can’t call super on them. Change your code to this: class Creature: SKSpriteNode { var isAlive:Bool = false { didSet { self.hidden = !isAlive } } var livingNeighbours:Int = 0 init() { … Read more