sprite-kit
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
Xcode 6 – xcassets for universal image support
This is a little confusing – here’s how I understand it (this is in reference to the top image): 1x images are for the original iPhone through the 3GS – ‘standard’ resolution devices (3.5″ screens) 2x images are for the iPhone 4 and 4S (3.5″ Retina screens) and are also used for the iPhone 6. … Read more
Shader performance data maybe unavailable due to deployment target older than device version
If you really don’t want to see this prompt, you can close it as shown below. You can find the above screenshot view on Products -> Scheme -> Edit Scheme
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