iOS Guides | Samples

SpriteKit Namespace

The SpriteKit namespace provides a library for 2D graphics, animation, and physics.

Remarks

Sprite Kit is a library that provides a high-performance animation and physics loop. It is well-suited for 2D game programming and is available on both iOS and OS X.

The animation loop:

The system restricts the animation loop to a maximum rate of 60Hz.

The visual aspect of the animation loop is determined by a scene-graph consisting of a hierarchy of SKNodes. The root of the scene-graph is a SKScene which itself is a SKNode (see illustration below). SKNodes can be rectangular, based on a CGPath, or display text. SKNodes can be textured, colored, or display video. They can have CoreFilters applied to them and can be composited.

SKNodes can have an associated SKPhysicsBody. All of the SKPhysicsBodys in the SKScene.PhysicsWorld of the SKScene are part of the physics loop. T:SpriteKitSKPhysicsBodys are joined to each other with SKJoints, of which there are several sub-classes as shown in the following illustration.

Tile Sets

The SKTileMapNode subclass of SKNode allows developers to easily create and manipulate tile-based maps with a variety of geometries and perspectives. An SKTileMapNode contains a SKTileSet that defines the overall map. In addition, the SKTileSet contains one or more SKTileGroup objects, each of which represents one style of tile, which may have several representations.

Classes

TypeReason
ISKPhysicsContactDelegateInterface representing the required methods (if any) of the protocol SKPhysicsContactDelegate.
ISKSceneDelegateInterface representing the required methods (if any) of the protocol SKSceneDelegate.
ISKViewDelegateInterface representing the required methods (if any) of the protocol SKViewDelegate.
ISKWarpable
SK3DNodeRenders a Scene Kit image as a textured 2D image. Used to incorporate Scene Kit content into a Sprite Kit app.
SKActionModifies properties on a SKNode, often animating the changes. Sometimes reversible.
SKActionDurationHandlerThe delegate for a custom action, used with SKAction.CustomActionWithDuration.
SKActionTimingFunctionA method that maps time, a value between 0 and 1, to a return value between 0 snd 1.
SKActionTimingModeAn enumeration whose values specify the time-varying behavior of a SKAction. Used with SKAction.TimingMode.
SKAttributeHolds per-node data to be used with a custom shader.
SKAttributeTypeEnumeration of valid types for SKAttribute values.
SKAttributeValueHolds the value, of the appropriate SKAttributeType, for an SKAttribute.
SKAudioNodeA SKNode that holds audio information.
SKBlendModeAn enumeration whose values specify options for blending of visual SKNodes or particles.
SKCameraNodeA node that specifies the position inside a SKScene from which it can be rendered.
SKConstraintMathematical constraint on a node's position or orientation.
SKCropNodeA node that masks its children's pixels.
SKEffectNodeAn SKNode that applies a Core Graphics CIFilter to its output.
SKEmitterNodeA SKNode that produces colored and textured particles.
SKFieldForceEvaluatorA method that derives a force by applying the physics of a field to a body that is within the field.
SKFieldNodeApplies physics effects within a portion of a scene.
SKInterpolationModeAn enumeration whose values specify the interpolation mode of a SKKeyframeSequence.
SKKeyframeSequenceAn object that can control the properties of particles emitted by a SKEmitterNode.
SKLabelHorizontalAlignmentModeAn enumeration whose values specify horizontal alignment of a SKLabelNode. Used with SKLabelNode.HorizontalAlignmentMode
SKLabelNodeA SKNode that displays a string.
SKLabelVerticalAlignmentMode An enumeration whose values specify vertical alignment of a SKLabelNode. Used with SKLabelNode.VerticalAlignmentMode
SKLightNodeA node that creates a lighting effect within a scene.
SKMutableTextureA texture that can be modified after assignment.
SKNodeThe building block out of which scene-graphs are made. The root of the tree is an SKScene.
SKNodeChildEnumeratorHandlerThe delegate that acts as the enumeration handler for SKNode.EnumerateChildNodes.
SKNodeFocusBehavior
SKNodeTouches_UITouchExtension methods for UITouch that aide with conversion to Sprite Kit coordinates.
SKParticleRenderOrderEnumerates values used with SKEmitterNode.ParticleRenderOrder.
SKPhysicsBodyAn object that reacts to the physics simulation of the SKScene's SKScene.PhysicsWorld.
SKPhysicsContactEncapsulates the data of a collision between two SKPhysicsBodys.
SKPhysicsContactDelegateA delegate object for SKPhysicsWorld that provides events when SKPhysicsBodys begin and end contact with each other.
SKPhysicsContactDelegate_ExtensionsExtension methods to the ISKPhysicsContactDelegate interface to support all the methods from the SKPhysicsContactDelegate protocol.
SKPhysicsJointBase class for subtypes that join bodies in the physics engine.
SKPhysicsJointFixedA SKPhysicsJoint that rigidly connects two bodies.
SKPhysicsJointLimitA SKPhysicsJoint that connects two bodies as if by a rope.
SKPhysicsJointPinA SKPhysicsJoint that pins two bodies to a common point.
SKPhysicsJointSlidingA SKPhysicsJoint that connects two bodies as if by a sliding rod.
SKPhysicsJointSpringA SKPhysicsJoint that connects two bodies as if by a spring.
SKPhysicsWorldManages the physics for a SKScene.
SKPhysicsWorldBodiesAlongRayStartEnumeratorHandlerThe delegate used for enumerating bodies that fall along a ray when used with SKPhysicsWorld.EnumerateBodies(PointF,PointF,SKPhysicsWorldBodiesAlongRayStartEnumeratorHandler).
SKPhysicsWorldBodiesEnumeratorHandlerThe delegate used to enumerate SKPhysicsBodys with SKPhysicsWorld.EnumerateBodies(PointF,SKPhysicsWorldBodiesEnumeratorHandler) and SKPhysicsWorld.EnumerateBodies(RectangleFF,SKPhysicsWorldBodiesEnumeratorHandler)
SKRangeDefines a range for acceptable float values.
SKReachConstraintsA range of motion used with inverse kinematics.
SKReferenceNodeA SKNode that holds an archived collection of child nodes that can be used in multiple places throughout the game.
SKRegionA path-defined area. Typically used for hit-testing and physics-field extents.
SKRenderer
SKRepeatModeAn enumeration whose values specify whether the time value of a SKKeyframeSequence should cycle.
SKSceneA scene of content in Sprite Kit. The root of a tree of Sprite Kit nodes.
SKSceneDelegateDelegate object for SKScene objects. Provides methods relating to animation events.
SKSceneDelegate_ExtensionsExtension methods to the ISKSceneDelegate interface to support all the methods from the SKSceneDelegate protocol.
SKSceneScaleModeAn enumeration whose values specify the way in which a SKScene scales to the view in which it is being displayed.
SKShaderAn OpenGL ES fragment shader.
SKShapeNodeA SKShapeNode defined by a Core Graphics CGPath.
SKSpriteNodeA SKShapeNode that displays a textured, colored sprite.
SKTextureAn image that can be used with one or more SKSpriteNodes and particles.
SKTextureAtlasA collection of SKTextures that are loaded from a single source.
SKTextureAtlasLoadCallback
SKTextureAtlasLoadResult
SKTextureFilteringModeAn enumeration whose values specify how a SKTexture is rendered on a SKSpriteNode of a different size.
SKTextureModifyA method that modifies a texture in place.
SKTileAdjacencyMask
SKTileDefinition
SKTileDefinitionRotation
SKTileGroupHolds either a single SKTileDefinition or a set of SKTileGroupRule objects defining relating SKTileDefinition objects.
SKTileGroupRule
SKTileMapNodeA SKNode that encapsulates a tiled map and a SKTileSet.
SKTileSetRepresents the possible elements of a SKTileMapNode in the form of SKTileGroup objects.
SKTileSetType
SKTransformNode
SKTransitionTransitions that can be used between SKScenes. Used with the SKView.PresentScene(SKScene,SKTransition) method.
SKTransitionDirectionAn enumeration of directions for use with SKTransitions.
SKUniformHolds shareable uniform data for SKShader objects.
SKUniformTypeContains values that describe the data with which an SKUniform was initialized.
SKVideoNodeA SKNode that displays video.
SKViewA UIView that displays a SKScene.
SKView+SKViewAppearanceAppearance class for objects of type SKView.
SKViewDelegate
SKViewDelegate_ExtensionsExtension methods to the ISKViewDelegate interface to support all the methods from the SKViewDelegate protocol.
SKWarpGeometry
SKWarpGeometryGrid