Back to Skills

spritekit

Build 2D games and animations using SpriteKit. Use when creating game scenes with SKScene and SKView, adding sprites with SKSpriteNode, animating with SKAction sequences, simulating physics with SKPhysicsBody and contact detection, creating particle effects with SKEmitterNode, building tile maps, using SKCameraNode, or integrating SpriteKit scenes in SwiftUI with SpriteView.

836stars43forksUpdated 7/6/2026

Security Assessment

Safe(100/100)
Security Score100/100

About spritekit

A development guide for building 2D games and interactive animations for iOS 26+ using SpriteKit and Swift 6.3. It applies when creating game scenes with SKScene and SKView, adding sprites with SKSpriteNode, animating with SKAction sequences, simulating physics with SKPhysicsBody and contact detection, creating particle effects with SKEmitterNode, building tile maps, using SKCameraNode, or embedding a scene in SwiftUI with SpriteView.

It explains that SKView presents an SKScene, the root of a node tree the framework renders each frame, and details the per-frame cycle from update through action evaluation, physics simulation, constraints, and final rendering, advising you to override only the callbacks you need. A node-type table covers SKSpriteNode, SKLabelNode, SKShapeNode, SKEmitterNode, SKCameraNode, SKTileMapNode, and more, along with naming and tree-search patterns and using zPosition with ignoresSiblingOrder for draw order.

Animation is handled with immutable, reusable SKAction objects combined via sequence, group, and repeatForever, including texture-based frame animation and timing modes. The physics section shows building bodies from circles, rectangles, or textures, and using categoryBitMask, collisionBitMask, and contactTestBitMask together with an SKPhysicsContactDelegate to detect contacts, with the recommendation to queue hits during simulation and apply mutations in update. It also covers forces and impulses, touch handling via the scene's UIResponder methods and nodes(at:), the camera, and SwiftUI integration, and closes with common mistakes and a review checklist.

FAQ

What platform and language version does it target?

iOS 26+ using SpriteKit and Swift 6.3.

How are nodes animated?

With SKAction objects such as moveBy, scale, rotate, and fade, combined via sequence, group, and repeatForever, plus texture animation using SKAction.animate(with:) and timing modes.

How does collision and contact detection work?

Physics bodies use categoryBitMask, collisionBitMask, and contactTestBitMask, and you implement SKPhysicsContactDelegate's didBegin, setting physicsWorld.contactDelegate in didMove(to:).

Can SpriteKit scenes be used in SwiftUI?

Yes, the skill covers SwiftUI integration via SpriteView.

How is drawing order controlled?

Set ignoresSiblingOrder = true on the SKView and use each node's zPosition; without it, nodes draw in tree order.

All Files

3 files
SKILL.md15.0 KB
View
references/spritekit-patterns.md19.0 KB
View
evals/evals.json4.4 KB
View

Install spritekit

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill