ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
§ª§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö SpriteKit
§Ó §ß§Ö§Ú§Ô§â§à§Ó§í§ç §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ§ç
§®§Ñ§Ü§ã §¤§â§Ú§Ò§à§Ó §®§à§ã§Ü§Ó§Ñ, 2016
§¹§ä§à §ä§Ñ§Ü§à§Ö SpriteKit?
? §Ó§í§ã§à§Ü§à§å§â§à§Ó§ß§Ö§Ó§í§Û 2D framework §Õ§Ý§ñ
§ã§à§Ù§Õ§Ñ§ß§Ú§ñ §Ú§Ô§â
? §à§ä§ß§à§ã§Ú§ä§Ö§Ý§î§ß§à §á§â§à§ã§ä §Ó §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ú
? §á§à§Ù§Ó§à§Ý§ñ§Ö§ä §Ú§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ä§î §Ó§Ú§Ù§å§Ñ§Ý§î§ß§í§Ö
§â§Ö§Õ§Ñ§Ü§ä§à§â§í §Õ§Ý§ñ §ß§Ñ§ã§ä§â§à§Û§Ü§Ú §ã§è§Ö§ß /
§Ñ§ß§Ú§Þ§Ñ§è§Ú§Ú
? §á§à§Õ§Õ§Ö§â§Ø§Ú§Ó§Ñ§Ö§ä§ã§ñ §Ó§ã§Ö§Þ§Ú §á§Ý§Ñ§ä§æ§à§â§Þ§Ñ§Þ§Ú
Apple: iOS / macOS / tvOS / watchOS
§¥§Ý§ñ §é§Ö§Ô§à §ß§Ñ§Þ SpriteKit?
§®§Ñ§Ü§ã §¤§â§Ú§Ò§à§Ó ¡ª §ª§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö SpriteKit §Ó §ß§Ö§Ú§Ô§â§à§Ó§í§ç §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ§ç
§®§Ñ§Ü§ã §¤§â§Ú§Ò§à§Ó ¡ª §ª§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö SpriteKit §Ó §ß§Ö§Ú§Ô§â§à§Ó§í§ç §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ§ç
§®§Ñ§Ü§ã §¤§â§Ú§Ò§à§Ó ¡ª §ª§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö SpriteKit §Ó §ß§Ö§Ú§Ô§â§à§Ó§í§ç §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ§ç
§¢§Ñ§Ù§à§Ó§í§Ö §Ü§à§Þ§á§à§ß§Ö§ß§ä§í SpriteKit
SKView
SKScene
SKNode SKNode SKNodeSKTransition
import UIKit
import SpriteKit
class OnboardingViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let actionView = SKView()
view.addSubview(actionView)
let margins = view.layoutMarginsGuide
actionView.leadingAnchor.constraint(equalTo: margins.leftAnchor).isActive = true
actionView.topAnchor.constraint(equalTo: margins.topAnchor).isActive = true
actionView.trailingAnchor.constraint(equalTo: margins.trailingAnchor).isActive = true
actionView.bottomAnchor.constraint(equalTo: margins.bottomAnchor).isActive = true
let myScene = SKScene(fileNamed: "OnboardingScene")
actionView.presentScene(myScene)
//...
}
}
§ª§Ö§â§Ñ§â§ç§Ú§ñ §à§Ò§ì§Ö§Ü§ä§à§Ó §Ó SKScene
SKNode
SKNode
SKNode
SKNode
SKScene
root
UIView
UIView
UIView
UIView
UIView
UIView
root
SKNode
child
§³§ä§â§à§Ú§ä§Ö§Ý§î§ß§í§Ö §Ò§Ý§à§Ü§Ú SpriteKit
SKNode
SKSpriteNode
SKEmitterNode
SKShapeNode
SKEffectNode
SKScene
iOS 7
SKFieldNode
SKLightNode
SK3DNode
iOS 8
SKCameraNode
SKAudioNode
SKReferenceNode
iOS 9
SKTileMapNode
SKWarpable
SKWarpGeometry
iOS 10
UIResponder
SKCropNode
SKLabelNode
SKVideoNode
SKSpriteNode
Size
mySprite.color = UIColor.blueColor()mySprite.texture = SKTexture.textureWithImageNamed(¡°GreenBottle¡±)
Anchor Point
mySprite.anchorPoint = CGPointMake(0.5, 0.5)
mySprite.size = CGSizeMake(100.0, 100.0)
SKNode
§³§ã§í§Ý§Ü§Ú §ß§Ñ §à§Ò§ì§Ö§Ü§ä§í SpriteKit
import SpriteKit
class OnboardingScene: SKScene {
var flowerSprite: SKSpriteNode
override init() {
flowerSprite = SKSpriteNode(imageNamed: "FlowerSpriteImage")
super.init()
addChild(flowerSprite)
}
//...
}
import SpriteKit
class BetterOnboardingScene: SKScene {
override init() {
let flowerSprite = SKSpriteNode(imageNamed: "FlowerSpriteImage")
flowerSprite.name = "flower"
super.init()
addChild(flowerSprite)
}
func moveFlower() {
let flower = childNode(withName: "flower")
//...
}
}
§³§Ú§ã§ä§Ö§Þ§Ñ §Ü§à§à§â§Õ§Ú§ß§Ñ§ä
SKScene
Y+
X+
0,0
Y-
X+
1,10,1
1,0
0.5,0.5
0,0
myScene.anchorPoint = CGPointMake(0,0)
myScene.anchorPoint = CGPointMake(0,1)
zPosition
-Z
+ZredSprite.zPosition = 0
blueSprite.zPosition = 10
secondBlueSprite.zPosition = 10secondBlueSprite.zPosition = -10
FRONT TOP
SKAction
let flowerSprite = SKSpriteNode(imageNamed: "FlowerSpriteImage")
let moveAction = SKAction.moveBy(x: 100.0, y: 0, duration: 1.0)
flowerSprite.run(moveAction)
flowerSprite.run(SKAction.rotate(byAngle: 45.0, duration: 1.0))
flowerSprite.run(SKAction.scale(by: 1.5, duration: 1.0))
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))
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
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)
§³§ã§í§Ý§Ü§Ú §ß§Ñ §â§Ö§ã§å§â§ã§í
? 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]!

More Related Content

§®§Ñ§Ü§ã §¤§â§Ú§Ò§à§Ó ¡ª §ª§ã§á§à§Ý§î§Ù§à§Ó§Ñ§ß§Ú§Ö SpriteKit §Ó §ß§Ö§Ú§Ô§â§à§Ó§í§ç §á§â§Ú§Ý§à§Ø§Ö§ß§Ú§ñ§ç