Questions tagged [sprite-kit]

SpriteKit is Apple's framework for creating 2D games for iOS 7+, macOS 10.9+, tvOS 9+ and watchOS 3+. It is a 2D rendering engine combined with a physics engine. It is compatible with both Objective-C and Swift.

SpriteKit provides a graphics rendering and animation infrastructure that you can use to animate arbitrary textured images, or sprites. SpriteKit uses a traditional rendering loop where the contents of each frame are processed before the frame is rendered.

SpriteKit is available on iOS (), macOS (), tvOS () and watchOS (). It uses the graphics hardware available on the hosting device to composite 2D images at high frame rates. SpriteKit supports many different kinds of content, including:

  • Untextured or textured rectangles (sprites)
  • Text
  • Arbitrary CGPath-based shapes
  • Video

SpriteKit also provides support for cropping and other special effects; you can apply these effects to all or a portion of your content. You can animate or change these elements in each frame. You can also attach physics bodies to these elements so that they properly support forces and collisions. Physics bodies can be created as rectangles or circles, follow CGPaths, or use an image's alpha to create a more complex physics body.

Since SpriteKit supports a rich rendering infrastructure and handles all of the low-level work to submit drawing commands to OpenGL () or Metal, you can focus your efforts on solving higher-level design problems and creating great gameplay.

Resources:

13201 questions
159
votes
4 answers

Class does not implement its superclass's required members

So I updated to Xcode 6 beta 5 today and noticed I received errors in nearly all of my subclasses of Apple's classes. The error states: Class 'x' does not implement its superclass's required members Here is one example I picked because this…
Epic Byte
  • 33,840
  • 12
  • 45
  • 93
82
votes
17 answers

Setting up buttons in SKScene

I'm discovering that UIButtons don't work very well with SKScene, So I'm attempting to subclass SKNode to make a button in SpriteKit. The way I would like it to work is that if I initialize a button in SKScene and enable touch events, then the…
AlexHeuman
  • 1,006
  • 1
  • 10
  • 14
81
votes
7 answers

How can I make a function execute every second in swift?

I want to add a score to the top of my scene in the game I am working on. The score is going to based on how long you last, and will increase every second. Thanks for the help in advance! import SpriteKit class easyScene: SKScene { let…
Ryan Allen
  • 883
  • 1
  • 7
  • 9
72
votes
2 answers

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

This code worked on first XCode 6 Beta, but on latest Beta it's not working and gives such errors Must call a designated initializer of the superclass SKSpriteNode: import SpriteKit class Creature: SKSpriteNode { var isAlive:Bool = false { …
Kosmetika
  • 20,774
  • 37
  • 108
  • 172
61
votes
11 answers

How do I detect if an SKSpriteNode has been touched

I am trying to detect if my sprite node has been touched and I have no idea where to start. let Pineapple = SKSpriteNode(imageNamed: "Pineappleimg") Pineapple.userInteractionEnabled = true Pineapple.position = CGPoint(x: CGRectGetMidX(self.frame) -…
James Brennan
  • 635
  • 1
  • 6
  • 7
55
votes
1 answer

Shader performance data maybe unavailable due to deployment target older than device version

In a nutshell, I just want to know if I should be concerned about this issue: runtime: GPU Frame Capture: Shader performance data maybe unavailable due to deployment target older than device version The device I am using is running iOS 12.0,…
CodeBender
  • 35,668
  • 12
  • 125
  • 132
54
votes
3 answers

Dealing with different iOS device resolutions in SpriteKit

I'm playing around with SpriteKit in Xcode 6, iOS 8 beta 5. Everything is all laid out and working perfectly on the iPhone 4S simulator, however when switching to the 5S, the elements at the bottom of the screen are cut off. It was to my…
Sawyer05
  • 1,604
  • 2
  • 22
  • 37
53
votes
5 answers

Xcode 6 - xcassets for universal image support

Currently working on a universal SpriteKit project. I'll be supporting the following devices: iPhone 4/s, iPhone 5/c/s, iPhone 6, iPhone 6+ iPad non-ret, iPad retina I am confused on the iPhone part. I already have 4 versions for my background…
aresz
  • 2,589
  • 6
  • 34
  • 51
47
votes
3 answers

Performing your own physics calculations for a collision in Sprite Kit

I'm trying to set up some elastic collisions using Sprite Kit. There is an issue with the case of multiple objects resting near each other as I asked in Sprite Kit Physics Collision Issue I am confused on the timing of the situation for a…
Cherr Skees
  • 1,508
  • 2
  • 21
  • 37
47
votes
7 answers

How to draw a line in Sprite-kit

How can one draw a line in Sprite-kit? For example if I want to draw a line in cocos2d, I could easily using ccDrawLine(); Is there an equivalent in sprite-kit?
Waruna
  • 1,174
  • 1
  • 9
  • 20
42
votes
2 answers

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

Based on the image below (I used different colours for circle and flat surface so they can be seen, but in the end the colours will be the same), using Swift and Spritekit, I am trying to create the effect of a circular object entering a thick…
NSologistic
  • 745
  • 4
  • 14
39
votes
7 answers

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

I need to add a rain particle effect to my app, I have been having a tough time finding ways to actually execute this idea. I tried following this CALayer approach tutorial : Link but I am not quite sure if this is the best approach, considering…
vzm
  • 2,440
  • 6
  • 28
  • 47
39
votes
5 answers

Making a SKScene's background transparent not working... is this a bug?

Is there a way to make a SKScene's background transparent and present that scene over another one seeing thru the transparency. The idea is to have the background of the presented scene like this: self.backgroundColor = [SKColor colorWithRed:0.0f…
Duck
  • 34,902
  • 47
  • 248
  • 470
38
votes
8 answers

SKSpriteNode - create a round corner node?

Is there a way to make a SKSpriteNode round cornered? I am trying to create a Tile likesqaure blocks with color filled SKSpriteNode: SKSpriteNode *tile = [SKSpriteNode spriteNodeWithColor:[UIColor colorWithRed:0.0/255.0 …
Haris Hussain
  • 2,531
  • 3
  • 25
  • 38
37
votes
4 answers

SKNode convertPoint toNode & fromNode confusion?

I am a little confused by how the SKNode methods convertPoint:fromNode: and convertPoint:ToNode: are working, I have looked at the docs but its not that obvious what they do. For example, this (see diagram below) is a small test I did using…
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294
1
2 3
99 100