This document discusses using SpriteKit, Apple's 2D game framework, for non-game applications. It introduces SpriteKit components like SKView, SKScene and SKNode that can be used to build interactive visual experiences. It also covers SpriteKit actions for animation, physics integration, and organizing visual hierarchies with nodes.
17. SKAction
let boomTextureAtlas = SKTextureAtlas(named: "BoomTextureAtlas")
var boomSpriteTextures = [SKTexture]()
for textureName in boomTextureAtlas.textureNames {
boomSpriteTextures.append(boomTextureAtlas.textureNamed(textureName))
}
let boomSprite = SKSpriteNode(texture: boomSpriteTextures[5])
boomSprite.run(SKAction.animate(with: boomSpriteTextures, timePerFrame: 0.2))
18. SKAction
let spriteSize = CGSize(width: 100.0, height: 100.0)
let blueRectSprite = SKSpriteNode(color: UIColor.blue, size: spriteSize)
blueRectSprite.physicsBody = SKPhysicsBody(rectangleOf: spriteSize)
gravityScene.addChild(blueRectSprite)
gravityScene.physicsWorld.gravity = CGVector(dx: 0.0, dy: -9.8)
G
19. SKAction
Move Rotate Scale
Aimate With Textures
Move
Aimate With Textures
Rotate Scale
timeSEQUENCE
GROUP
let sequenceAction = SKAction.sequence([moveAction, rotateAction, scaleAction])
let groupAction = SKAction.sequence([sequenceAction, animateWithTexturesAction])
let secondGroupAction = SKAction.group([moveAction, SKAction.sequence([rotateAction, scaleAction]),
animateWithTexturesAction])
let hugeSequenceAction = SKAction.sequence([groupAction, secondGroupAction])
blueRectSprite.run(hugeSequenceAction)
20. §³§ã§í§Ý§Ü§Ú §ß§Ñ §â§Ö§ã§å§â§ã§í
? Session 502 Introduction to Sprite Kit WWDC 2013
? Session 503 Designing Games with Sprite Kit WWDC 2013
? Session 608 Best Practices for Building SpriteKit Games WWDC 2014
? Session 604 What's New in SpriteKit WWDC 2015
? Session 610 What's New in SpriteKit WWDC 2016
? Apple SpriteKit Programming Guide [Objective C]!