{"id":3068,"date":"2013-09-19T18:04:03","date_gmt":"2013-09-19T09:04:03","guid":{"rendered":"http:\/\/peta.okechan.net\/blog\/?p=3068"},"modified":"2013-12-22T03:11:38","modified_gmt":"2013-12-21T18:11:38","slug":"spritekit%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b-%e3%81%9d%e3%81%ae1","status":"publish","type":"post","link":"https:\/\/peta.okechan.net\/blog\/archives\/3068","title":{"rendered":"SpriteKit\u3092\u4f7f\u3063\u3066\u307f\u308b \u305d\u306e1"},"content":{"rendered":"<p>iOS 7 SDK\u306bSpriteKit\u306a\u308b\u3082\u306e\u304c\u8ffd\u52a0\u3055\u308c\u305f\u3002<br \/>\n\u3053\u308c\u306f2D\u30b9\u30d7\u30e9\u30a4\u30c8\u3092\u7c21\u5358\u306b\u6271\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3001\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u6a5f\u80fd\u3084\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u3084\u30d1\u30fc\u30c6\u30a3\u30af\u30eb\u30b7\u30b9\u30c6\u30e0\u306a\u3069\u3082\u542b\u307e\u308c\u3066\u3044\u308b\u307f\u305f\u3044\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u3072\u3068\u901a\u308a\u4f7f\u3063\u3066\u307f\u306a\u3044\u3068\u4f7f\u3044\u52dd\u624b\u306f\u5206\u304b\u3089\u306a\u3044\u3051\u3069\u3001\u7c21\u5358\u306a2D\u30b2\u30fc\u30e0\u306a\u3089SpriteKit\u3067\u4e8b\u8db3\u308a\u308b\u3093\u3067\u306f\u306a\u304b\u308d\u3046\u304b\u3068\u601d\u3046\u3002<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3068\u308a\u3042\u3048\u305a\u4eca\u56de\u306fXcode 5\u306b\u3042\u3089\u304b\u3058\u3081\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3001SpriteKit Game\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f7f\u3063\u3066\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001\u81ea\u52d5\u4f5c\u6210\u3055\u308c\u308b\u30bd\u30fc\u30b9\u3068\u30a2\u30d7\u30ea\u306e\u52d5\u304d\u3092\u898b\u3066\u307f\u308b\u3002<\/p>\n<p>\u307e\u305a\u3001SpriteKit Game\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u9078\u629e\u3002<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.27.14.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.27.14-300x201.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2013-09-19 13.27.14\" width=\"300\" height=\"201\" class=\"alignnone size-medium wp-image-3069\" srcset=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.27.14-300x201.png 300w, https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.27.14.png 732w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n\u5b9f\u969b\u306b\u3084\u308b\u524d\u306f\u3001OpenGL Game\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u9078\u3093\u3067\u304b\u3089SpriteKit\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u8ffd\u52a0\u3059\u308b\u3088\u3046\u306a\u3084\u308a\u65b9\u304b\u306a\u3068\u601d\u3063\u3066\u3044\u305f\u3051\u3069\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u81ea\u4f53\u5225\u306b\u306a\u3063\u3066\u308b\u3057\u3001\u81ea\u52d5\u3067\u4f5c\u6210\u3055\u308c\u308b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306fSpriteKit\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u53c2\u7167\u3057\u3066\u306f\u3044\u308b\u304cOpenGL\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u53c2\u7167\u3057\u3066\u3044\u306a\u3044\u3002<br \/>\n\u3053\u308c\u306f\u60f3\u50cf\u3060\u3051\u3069\u3001SpriteKit\u306fOpenGL\u306e\u4e0a\u306b\u8f09\u3063\u305f\u8584\u3044\u5c64\u306e\u306f\u305a\u3002<br \/>\n\u7d20\u306eOpenGL\u3068\u6bd4\u3079\u3066\u3069\u306e\u304f\u3089\u3044\u901f\u5ea6\u7684\u306a\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u304c\u3042\u308b\u306e\u304b\u3001\u305d\u3057\u3066\u7d20\u306eOpenGL\u3068\u3069\u3046\u3084\u3063\u3066\u9023\u643a\u3055\u305b\u308b\u304b\uff08\u305d\u3082\u305d\u3082\u305d\u3046\u3044\u3046\u4e8b\u304c\u53ef\u80fd\u304b\uff09\u4f59\u88d5\u304c\u3042\u308c\u3070\u5225\u9014\u78ba\u8a8d\u3057\u3066\u307f\u305f\u3044\u3002<\/p>\n<p>\u3055\u3066\u3001\u81ea\u52d5\u751f\u6210\u3055\u308c\u305f\u30bd\u30fc\u30b9\u306e\u69cb\u6210\u3068\u3057\u3066\u306f\u3001\u57fa\u672c\u7684\u306b\u306fAppDelegate\u3068ViewController\uff08\u3068\u30b9\u30c8\u30fc\u30ea\u30fc\u30dc\u30fc\u30c9\uff09\u304b\u3089\u306a\u308b\u666e\u901a\u306e\u6700\u5c0f\u9650\u306e\u30a2\u30d7\u30ea\u3068\u540c\u3058\u3067\u3042\u308b\u304c\u3001\u305d\u308c\u306b\u52a0\u3048\u3066\u3072\u3068\u3064\u3060\u3051MyScene\u3068\u3044\u3046\u30af\u30e9\u30b9\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u30bd\u30fc\u30b9\u3092\u898b\u308b\u307e\u3048\u306b\u3001\u81ea\u52d5\u751f\u6210\u3055\u308c\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u3069\u3046\u3044\u3046\u30a2\u30d7\u30ea\u306a\u306e\u304b\u5b9f\u884c\u3057\u3066\u78ba\u304b\u3081\u3066\u307f\u308b\u3002<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.36.54.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.36.54-180x300.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2013-09-19 13.36.54\" width=\"180\" height=\"300\" class=\"alignnone size-medium wp-image-3074\" srcset=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.36.54-180x300.png 180w, https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.36.54.png 594w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><br \/>\n\u30bf\u30c3\u30d7\u3057\u305f\u7b87\u6240\u306b\u4e00\u5b9a\u901f\u5ea6\u3067\u56de\u8ee2\u3059\u308b\u98db\u884c\u6a5f\uff08\u5b87\u5b99\u8239\uff1f\uff09\u306e\u30b9\u30d7\u30e9\u30a4\u30c8\u304c\u8868\u793a\u3055\u308c\u308b\u30a2\u30d7\u30ea\u306e\u3088\u3046\u3067\u3042\u308b\u3002<br \/>\n\u3069\u3093\u3069\u3093\u30bf\u30c3\u30d7\u3059\u308b\u3068\u98db\u884c\u6a5f\u3082\u5897\u3048\u3066\u3044\u304f\u3002<br \/>\n\u753b\u9762\u4e0b\u90e8\u306b\u30ce\u30fc\u30c9\u6570\uff08\u30b9\u30d7\u30e9\u30a4\u30c8\u6570\uff09\u3068fps\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u70b9\u306b\u6ce8\u610f\u3002<\/p>\n<p>\u3055\u3066\u3001\u30bd\u30fc\u30b9\u3067\u3042\u308b\u304c\u3001AppDelegate\u30af\u30e9\u30b9\u306b\u306f\u7279\u306bSpriteKit\u95a2\u9023\u306e\u8a18\u8ff0\u306f\u306a\u3044\u306e\u3067\u3001ViewController\u304b\u3089\u898b\u3066\u3044\u304f\u3002<\/p>\n<p>ViewController\u81ea\u4f53\u306fUIViewController\u3092\u7d99\u627f\u3057\u3066\u3044\u308b\u3054\u304f\u666e\u901a\u306eViewController\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u30d8\u30c3\u30c0\u306eimport\u3092\u9664\u3051\u3070\u3001SpriteKit\u306b\u95a2\u4fc2\u3042\u308b\u90e8\u5206\u306fviewDidLoad\u30e1\u30bd\u30c3\u30c9\u3060\u3051\u3067\u3042\u308b\u3002<br \/>\n\u4ee5\u4e0b\u3001ViewController.m\u306e-(void)viewDidLoad\u3002<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">- (void)viewDidLoad\r\n{\r\n    &#x5B;super viewDidLoad];\r\n\r\n    \/\/ Configure the view.\r\n    SKView * skView = (SKView *)self.view;\r\n    skView.showsFPS = YES;\r\n    skView.showsNodeCount = YES;\r\n    \r\n    \/\/ Create and configure the scene.\r\n    SKScene * scene = &#x5B;MyScene sceneWithSize:skView.bounds.size];\r\n    scene.scaleMode = SKSceneScaleModeAspectFill;\r\n    \r\n    \/\/ Present the scene.\r\n    &#x5B;skView presentScene:scene];\r\n}<\/pre>\n<p>\u3044\u304d\u306a\u308aself.view\u3092SKView*\u306b\u30ad\u30e3\u30b9\u30c8\u3057\u3066\u308b\u304c\u3001\u3053\u308c\u306f\u30b9\u30c8\u30fc\u30ea\u30fc\u30dc\u30fc\u30c9\u3067view\u306e\u30af\u30e9\u30b9\u3068\u3057\u3066SKView\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u53ef\u80fd\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u4e0a\u8a18\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u306b\u3042\u3063\u305f\u30ce\u30fc\u30c9\u6570\u3068fps\u306e\u8868\u793a\u3067\u3042\u308b\u304c\u3001\u305d\u308c\u305e\u308c1\u884c\u3067\u30aa\u30f3\u306b\u51fa\u6765\u308b\u3088\u3046\u3067\u3042\u308b\u3002<br \/>\n\u3053\u308c\u306f\u697d\u3060\u3002<\/p>\n<p>MyScene\uff08SKScene\u3092\u7d99\u627f\u3057\u305f\u30af\u30e9\u30b9\u3002\u5f8c\u307b\u3069\u8aac\u660e\u3059\u308b\u3002\uff09\u3092\u751f\u6210\u3057\u3066\u3044\u308b\u3002<br \/>\nSKScene\u306fSKNode\u3092\u7d99\u627f\uff08\u3057\u305fSKEffectNode\u3092\u3055\u3089\u306b\u7d99\u627f\uff09\u3057\u305f\u30af\u30e9\u30b9\u3067\u3001\u307e\u3041\u5927\u96d1\u628a\u306b\u306f\u753b\u9762\u5358\u4f4d\u3067\u30ce\u30fc\u30c9\u3092\u53d6\u308a\u307e\u3068\u3081\u308b\u305f\u3081\u306e\u30af\u30e9\u30b9\u306e\u3088\u3046\u3067\u3042\u308b\u3002<br \/>\n\u3061\u306a\u307f\u306bSKNode\u306fUIResponder\u3092\u7d99\u627f\u3057\u3066\u3044\u308b\u306e\u3067UIKit\u95a2\u9023\u306e\u30af\u30e9\u30b9\u3068\u540c\u3058\u3088\u3046\u306b\u64cd\u4f5c\u51fa\u6765\u308b\u3093\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u308f\u308c\u308b\u3002<\/p>\n<p>[skView presentScene:scene]\u306b\u3088\u3063\u3066\u30b7\u30fc\u30f3\u304cview\u306b\u8868\u793a\u3055\u308c\u308b\u3002<br \/>\n\u3059\u3067\u306b\u8868\u793a\u4e2d\u306e\u30b7\u30fc\u30f3\u304c\u3042\u308c\u3070\u7f6e\u304d\u63db\u3048\u3089\u308c\u308b\u3002<\/p>\n<p>\u6b21\u306bMyScene\u306e\u30bd\u30fc\u30b9\u306b\u3064\u3044\u3066\u3067\u3042\u308b\u304c\u3001\u4e2d\u8eab\u304c\u3042\u308b\u30e1\u30bd\u30c3\u30c9\u306f\u4ee5\u4e0b\u306e2\u3064\u3060\u3051\u3068\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">-(id)initWithSize:(CGSize)size {    \r\n    if (self = &#x5B;super initWithSize:size]) {\r\n        \/* Setup your scene here *\/\r\n        \r\n        self.backgroundColor = &#x5B;SKColor colorWithRed:0.15 green:0.15 blue:0.3 alpha:1.0];\r\n        \r\n        SKLabelNode *myLabel = &#x5B;SKLabelNode labelNodeWithFontNamed:@&quot;Chalkduster&quot;];\r\n        \r\n        myLabel.text = @&quot;Hello, World!&quot;;\r\n        myLabel.fontSize = 30;\r\n        myLabel.position = CGPointMake(CGRectGetMidX(self.frame),\r\n                                       CGRectGetMidY(self.frame));\r\n        \r\n        &#x5B;self addChild:myLabel];\r\n    }\r\n    return self;\r\n}\r\n\r\n-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {\r\n    \/* Called when a touch begins *\/\r\n    \r\n    for (UITouch *touch in touches) {\r\n        CGPoint location = &#x5B;touch locationInNode:self];\r\n        \r\n        SKSpriteNode *sprite = &#x5B;SKSpriteNode spriteNodeWithImageNamed:@&quot;Spaceship&quot;];\r\n        \r\n        sprite.position = location;\r\n        \r\n        SKAction *action = &#x5B;SKAction rotateByAngle:M_PI duration:1];\r\n        \r\n        &#x5B;sprite runAction:&#x5B;SKAction repeatActionForever:action]];\r\n        \r\n        &#x5B;self addChild:sprite];\r\n    }\r\n}<\/pre>\n<p>\u307e\u305a\u3001-(id)initWithSize:(CGSize)size\u3067\u3042\u308b\u304c\u3001\u3053\u308c\u306fViewController.m\u3067\u547c\u3093\u3067\u3044\u308bsceneWithSize\u304b\u3089\u5185\u90e8\u7684\u306b\u547c\u3070\u308c\u308b\u3002<br \/>\n\u3084\u3063\u3066\u308b\u3053\u3068\u306f\u7c21\u5358\u3067\u3001\u80cc\u666f\u8272\u3092\u6307\u5b9a\u3057\u3066\u30e9\u30d9\u30eb\uff08SKLabelNode\uff09\u3092\u3072\u3068\u3064\u8ffd\u52a0\u3057\u3066\u308b\u3060\u3051\u3067\u3042\u308b\u3002<br \/>\n\u30e9\u30d9\u30eb\u306e\u64cd\u4f5c\u306b\u3064\u3044\u3066\u306f\u898b\u305f\u307e\u3093\u307e\u5206\u304b\u308a\u3084\u3059\u3044\u3002<br \/>\n\u3061\u306a\u307f\u306bSKLabelNode\u3082SKNode\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u3067\u3042\u308b\u3002<\/p>\n<p>SKColor\u306b\u3064\u3044\u3066\u306f\u300c\u3046\u308f\u3001\u307e\u305f\u65b0\u3057\u3044\u8272\u30af\u30e9\u30b9\u304b\u300d\u3068\u601d\u3046\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u5b9f\u969b\u306f\u5358\u306a\u308b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30de\u30af\u30ed\u3067\u3042\u308b\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">#if TARGET_OS_IPHONE\r\n#define SKColor UIColor\r\n#else\r\n#define SKColor NSColor\r\n#endif<\/pre>\n<p>\u6b21\u306b\u3001-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event\u3067\u3042\u308b\u304c\u3001UIView\u306a\u3069\u3068\u540c\u3058\u304f\u30bf\u30c3\u30c1\u30a4\u30d9\u30f3\u30c8\u3092\u53d7\u3051\u53d6\u308b\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u3042\u308b\u3002<\/p>\n<p>\u898b\u3069\u3053\u308d\u306f2\u3064\u3042\u3063\u3066\u3001\u307e\u305a\u306f[SKSpriteNode spriteNodeWithImageNamed:@&#8221;Spaceship&#8221;]\u306e\u90e8\u5206\u3060\u308d\u3046\u3002<br \/>\n\u305f\u3063\u305f1\u884c\u3067\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30b9\u30d7\u30e9\u30a4\u30c8\u30ce\u30fc\u30c9\u306e\u751f\u6210\u304c\u53ef\u80fd\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u3053\u308c\u306f\u697d\u3060\u3002<br \/>\n\u3082\u3061\u308d\u3093SKSpriteNode\u3082SKNode\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u3067\u3042\u308b\u3002<\/p>\n<p>\u3082\u30461\u3064\u306e\u898b\u3069\u3053\u308d\u306fSKAction\u95a2\u9023\u306e\u90e8\u5206\u3060\u308d\u3046\u3002<br \/>\n\u6587\u5b57\u901a\u308a\u30ce\u30fc\u30c9\u306e\u52d5\u4f5c\u3092\u8868\u3059\u30af\u30e9\u30b9\u3067\u3001\u5185\u90e8\u7684\u306b\u306f\u30b7\u30fc\u30f3\u306b\u914d\u7f6e\u3057\u305f\u30ce\u30fc\u30c9\u304c\u51e6\u7406\u3055\u308c\u308b\u5ea6\u306b\u3001\u305d\u306e\u30ce\u30fc\u30c9\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u30a2\u30af\u30b7\u30e7\u30f3\u304c\u8a55\u4fa1\u3055\u308c\u308b\u3068\u3044\u3046\u4ed5\u7d44\u307f\u306b\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u3064\u307e\u308a\u30b7\u30fc\u30f3\u306b\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u30ce\u30fc\u30c9\uff08\u3082\u3057\u304f\u306f\u3053\u308c\u304b\u3089\u30b7\u30fc\u30f3\u306b\u8ffd\u52a0\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u30ce\u30fc\u30c9\uff09\u306b\u4e00\u5ea6\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u8a2d\u5b9a\u3057\u305f\u3089\u3001\u3042\u3068\u306f\u81ea\u52d5\u7684\u306b\u305d\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u304c\u5b9f\u884c\u3055\u308c\u308b\u3002<\/p>\n<p>\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u307e\u305a\u3001[SKAction rotateByAngle:M_PI duration:1]\u30671\u79d2\u3067180\u5ea6\u56de\u8ee2\u3059\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u751f\u6210\u3057\u3066\u3044\u308b\u3002<br \/>\n\u6b63\u306e\u89d2\u5ea6\u3067\u53cd\u6642\u8a08\u56de\u308a\u3001\u8ca0\u306e\u89d2\u5ea6\u3067\u6642\u8a08\u56de\u308a\u3068\u306a\u308b\u3002<br \/>\nduration\u3092\u79d2\u5358\u4f4d\u3067\u6307\u5b9a\u3059\u308b\u3053\u3068\u304b\u3089\u3082\u5206\u304b\u308b\u304c\u3001\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u901f\u5ea6\u306ffps\u306b\u4f9d\u5b58\u3057\u3066\u3044\u306a\u3044\u3002<br \/>\n\u3064\u307e\u308afps\u304c\u4f4e\u304f\u306a\u308c\u3070\u30a2\u30af\u30b7\u30e7\u30f3\u306f\u30ab\u30af\u30ab\u30af\u306b\u306f\u306a\u308b\u304c\u3001\u6307\u5b9a\u3055\u308c\u305fduration\u3067\u6307\u5b9a\u3055\u308c\u305f\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u884c\u3046\u3088\u3046\u306b\u52d5\u4f5c\u3059\u308b\u3002<br \/>\n\uff08\u3068\u306f\u3044\u3063\u3066\u3082\u3001\u5b9f\u969b\u306b\u306ffps\u304c\u6975\u7aef\u306b\u4e0b\u304c\u308b\u307b\u3069\u91cd\u3044\u5834\u9762\u3067\u306f\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u5b9f\u884c\u3082\u305d\u308c\u306a\u308a\u306b\u5f71\u97ff\u3092\u53d7\u3051\u308b\u306f\u305a\u3067\u3042\u308b\u3002\uff09<\/p>\n<p>\u6b21\u306b\u3001[sprite runAction:[SKAction repeatActionForever:action]]\u3067\u30011\u79d2\u3067180\u5ea6\u56de\u8ee2\u3059\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u6c38\u9060\u306b\u7e70\u308a\u8fd4\u3059\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u751f\u6210\u3057\u3001\u30ce\u30fc\u30c9\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u3002<br \/>\n\u3053\u308c\u304b\u3089\u5206\u304b\u308b\u3068\u304a\u308a\u3001\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u7e70\u308a\u8fd4\u3059\u305f\u3081\u306b\u306f\u3001\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306a\u3069\u3067\u8a2d\u5b9a\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u5165\u308c\u5b50\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u307f\u305f\u3044\u3002<\/p>\n<p>\u3056\u3063\u3068SKAction.h\u3092\u898b\u305f\u3068\u3053\u308d\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u306f\u8272\u3005\u3042\u3063\u3066\u3001\u79fb\u52d5\u3001\u56de\u8ee2\u3001\u62e1\u7e2e\u3001\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8\u3001\u8907\u6570\u306e\u753b\u50cf\u3092\u5207\u66ff\u3048\u308b\u4e8b\u306b\u3088\u308b\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3001\u97f3\u306e\u518d\u751f\u3001\u30d6\u30ed\u30c3\u30af\uff08\u3044\u308f\u3086\u308b\u30af\u30ed\u30fc\u30b8\u30e3\u3084\u30e9\u30e0\u30c0\u5f0f\u306e\u3088\u3046\u306a\u3082\u306e\uff09\u306e\u5b9f\u884c\u306a\u3069\u304c\u3042\u308b\u3002<br \/>\n\u3055\u3089\u306b\u3053\u308c\u3089\u3092\u7e70\u308a\u8fd4\u3057\u305f\u308a\u3001\u9806\u306b\u5b9f\u884c\u3059\u308b\u3088\u3046\u306a\u30a2\u30af\u30b7\u30e7\u30f3\u3082\u4f5c\u6210\u51fa\u6765\u308b\u3002<\/p>\n<p>\u7c21\u5358\u306a\u30b2\u30fc\u30e0\u306a\u3089\u3001\u307b\u3068\u3093\u3069\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u8a18\u8ff0\u3060\u3051\u3067\u4f5c\u308c\u305d\u3046\u306a\u6c17\u304c\u3059\u308b\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u3053\u3053\u307e\u3067\u3002<br \/>\n\u30bf\u30a4\u30c8\u30eb\u306b\u300c\u305d\u306e1\u300d\u3068\u4ed8\u3044\u3066\u308b\u901a\u308a\u3001\u300c\u305d\u306e2\u300d\u300c\u305d\u306e3\u300d\u3068\u7d9a\u3051\u308b\u3064\u3082\u308a\u3067\u3042\u308b\u3002<\/p>\n<p>\u300c\u305d\u306e2\u300d\u3067\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u306b\u3064\u3044\u3066\u3001\u300c\u305d\u306e3\u300d\u3067\u30d1\u30fc\u30c6\u30a3\u30af\u30eb\u306b\u3064\u3044\u3066\u7c21\u5358\u306b\u898b\u3066\u3044\u3053\u3046\u304b\u306a\u3068\u601d\u3063\u3066\u3044\u308b\u3051\u3069\u3001\u9577\u304f\u306a\u308a\u305d\u3046\u306a\u3089\u5206\u5272\u3059\u308b\u304b\u3082\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>iOS 7 SDK\u306bSpriteKit\u306a\u308b\u3082\u306e\u304c\u8ffd\u52a0\u3055\u308c\u305f\u3002<br \/>\n\u3053\u308c\u306f2D\u30b9\u30d7\u30e9\u30a4\u30c8\u3092\u7c21\u5358\u306b\u6271\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3001\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u6a5f\u80fd\u3084\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u3084\u30d1\u30fc\u30c6\u30a3\u30af\u30eb\u30b7\u30b9\u30c6\u30e0\u306a\u3069\u3082\u542b\u307e\u308c\u3066\u3044\u308b\u307f\u305f\u3044\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u3072\u3068\u901a\u308a\u4f7f\u3063\u3066\u307f\u306a\u3044\u3068\u4f7f\u3044\u52dd\u624b\u306f\u5206\u304b\u3089\u306a\u3044\u3051\u3069\u3001\u7c21\u5358\u306a2D\u30b2\u30fc\u30e0\u306a\u3089SpriteKit\u3067\u4e8b\u8db3\u308a\u308b\u3093\u3067\u306f\u306a\u304b\u308d\u3046\u304b\u3068\u601d\u3046\u3002<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3068\u308a\u3042\u3048\u305a\u4eca\u56de\u306fXcode 5\u306b\u3042\u3089\u304b\u3058\u3081\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3001SpriteKit Game\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f7f\u3063\u3066\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001\u81ea\u52d5\u4f5c\u6210\u3055\u308c\u308b\u30bd\u30fc\u30b9\u3068\u30a2\u30d7\u30ea\u306e\u52d5\u304d\u3092\u898b\u3066\u307f\u308b\u3002<\/p>\n<p>\u307e\u305a\u3001SpriteKit Game\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u9078\u629e\u3002<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.27.14.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.27.14-300x201.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2013-09-19 13.27.14\" width=\"300\" height=\"201\" class=\"alignnone size-medium wp-image-3069\" srcset=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.27.14-300x201.png 300w, https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.27.14.png 732w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n\u5b9f\u969b\u306b\u3084\u308b\u524d\u306f\u3001OpenGL Game\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u9078\u3093\u3067\u304b\u3089SpriteKit\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u8ffd\u52a0\u3059\u308b\u3088\u3046\u306a\u3084\u308a\u65b9\u304b\u306a\u3068\u601d\u3063\u3066\u3044\u305f\u3051\u3069\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u81ea\u4f53\u5225\u306b\u306a\u3063\u3066\u308b\u3057\u3001\u81ea\u52d5\u3067\u4f5c\u6210\u3055\u308c\u308b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306fSpriteKit\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u53c2\u7167\u3057\u3066\u306f\u3044\u308b\u304cOpenGL\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u53c2\u7167\u3057\u3066\u3044\u306a\u3044\u3002<br \/>\n\u3053\u308c\u306f\u60f3\u50cf\u3060\u3051\u3069\u3001SpriteKit\u306fOpenGL\u306e\u4e0a\u306b\u8f09\u3063\u305f\u8584\u3044\u5c64\u306e\u306f\u305a\u3002<br \/>\n\u7d20\u306eOpenGL\u3068\u6bd4\u3079\u3066\u3069\u306e\u304f\u3089\u3044\u901f\u5ea6\u7684\u306a\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u304c\u3042\u308b\u306e\u304b\u3001\u305d\u3057\u3066\u7d20\u306eOpenGL\u3068\u3069\u3046\u3084\u3063\u3066\u9023\u643a\u3055\u305b\u308b\u304b\uff08\u305d\u3082\u305d\u3082\u305d\u3046\u3044\u3046\u4e8b\u304c\u53ef\u80fd\u304b\uff09\u4f59\u88d5\u304c\u3042\u308c\u3070\u5225\u9014\u78ba\u8a8d\u3057\u3066\u307f\u305f\u3044\u3002<\/p>\n<p>\u3055\u3066\u3001\u81ea\u52d5\u751f\u6210\u3055\u308c\u305f\u30bd\u30fc\u30b9\u306e\u69cb\u6210\u3068\u3057\u3066\u306f\u3001\u57fa\u672c\u7684\u306b\u306fAppDelegate\u3068ViewController\uff08\u3068\u30b9\u30c8\u30fc\u30ea\u30fc\u30dc\u30fc\u30c9\uff09\u304b\u3089\u306a\u308b\u666e\u901a\u306e\u6700\u5c0f\u9650\u306e\u30a2\u30d7\u30ea\u3068\u540c\u3058\u3067\u3042\u308b\u304c\u3001\u305d\u308c\u306b\u52a0\u3048\u3066\u3072\u3068\u3064\u3060\u3051MyScene\u3068\u3044\u3046\u30af\u30e9\u30b9\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u30bd\u30fc\u30b9\u3092\u898b\u308b\u307e\u3048\u306b\u3001\u81ea\u52d5\u751f\u6210\u3055\u308c\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u304c\u3069\u3046\u3044\u3046\u30a2\u30d7\u30ea\u306a\u306e\u304b\u5b9f\u884c\u3057\u3066\u78ba\u304b\u3081\u3066\u307f\u308b\u3002<br \/>\n<a href=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.36.54.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.36.54-180x300.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2013-09-19 13.36.54\" width=\"180\" height=\"300\" class=\"alignnone size-medium wp-image-3074\" srcset=\"https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.36.54-180x300.png 180w, https:\/\/peta.okechan.net\/blog\/wp-content\/uploads\/2013\/09\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2013-09-19-13.36.54.png 594w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><br \/>\n\u30bf\u30c3\u30d7\u3057\u305f\u7b87\u6240\u306b\u4e00\u5b9a\u901f\u5ea6\u3067\u56de\u8ee2\u3059\u308b\u98db\u884c\u6a5f\uff08\u5b87\u5b99\u8239\uff1f\uff09\u306e\u30b9\u30d7\u30e9\u30a4\u30c8\u304c\u8868\u793a\u3055\u308c\u308b\u30a2\u30d7\u30ea\u306e\u3088\u3046\u3067\u3042\u308b\u3002<br \/>\n\u3069\u3093\u3069\u3093\u30bf\u30c3\u30d7\u3059\u308b\u3068\u98db\u884c\u6a5f\u3082\u5897\u3048\u3066\u3044\u304f\u3002<br \/>\n\u753b\u9762\u4e0b\u90e8\u306b\u30ce\u30fc\u30c9\u6570\uff08\u30b9\u30d7\u30e9\u30a4\u30c8\u6570\uff09\u3068fps\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u70b9\u306b\u6ce8\u610f\u3002<\/p>\n<p>\u3055\u3066\u3001\u30bd\u30fc\u30b9\u3067\u3042\u308b\u304c\u3001AppDelegate\u30af\u30e9\u30b9\u306b\u306f\u7279\u306bSpriteKit\u95a2\u9023\u306e\u8a18\u8ff0\u306f\u306a\u3044\u306e\u3067\u3001ViewController\u304b\u3089\u898b\u3066\u3044\u304f\u3002<\/p>\n<p>ViewController\u81ea\u4f53\u306fUIViewController\u3092\u7d99\u627f\u3057\u3066\u3044\u308b\u3054\u304f\u666e\u901a\u306eViewController\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u30d8\u30c3\u30c0\u306eimport\u3092\u9664\u3051\u3070\u3001SpriteKit\u306b\u95a2\u4fc2\u3042\u308b\u90e8\u5206\u306fviewDidLoad\u30e1\u30bd\u30c3\u30c9\u3060\u3051\u3067\u3042\u308b\u3002<br \/>\n\u4ee5\u4e0b\u3001ViewController.m\u306e-(void)viewDidLoad\u3002<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">- (void)viewDidLoad\r\n{\r\n    &#x5B;super viewDidLoad];\r\n\r\n    \/\/ Configure the view.\r\n    SKView * skView = (SKView *)self.view;\r\n    skView.showsFPS = YES;\r\n    skView.showsNodeCount = YES;\r\n    \r\n    \/\/ Create and configure the scene.\r\n    SKScene * scene = &#x5B;MyScene sceneWithSize:skView.bounds.size];\r\n    scene.scaleMode = SKSceneScaleModeAspectFill;\r\n    \r\n    \/\/ Present the scene.\r\n    &#x5B;skView presentScene:scene];\r\n}<\/pre>\n<p>\u3044\u304d\u306a\u308aself.view\u3092SKView*\u306b\u30ad\u30e3\u30b9\u30c8\u3057\u3066\u308b\u304c\u3001\u3053\u308c\u306f\u30b9\u30c8\u30fc\u30ea\u30fc\u30dc\u30fc\u30c9\u3067view\u306e\u30af\u30e9\u30b9\u3068\u3057\u3066SKView\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u53ef\u80fd\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u4e0a\u8a18\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u306b\u3042\u3063\u305f\u30ce\u30fc\u30c9\u6570\u3068fps\u306e\u8868\u793a\u3067\u3042\u308b\u304c\u3001\u305d\u308c\u305e\u308c1\u884c\u3067\u30aa\u30f3\u306b\u51fa\u6765\u308b\u3088\u3046\u3067\u3042\u308b\u3002<br \/>\n\u3053\u308c\u306f\u697d\u3060\u3002<\/p>\n<p>MyScene\uff08SKScene\u3092\u7d99\u627f\u3057\u305f\u30af\u30e9\u30b9\u3002\u5f8c\u307b\u3069\u8aac\u660e\u3059\u308b\u3002\uff09\u3092\u751f\u6210\u3057\u3066\u3044\u308b\u3002<br \/>\nSKScene\u306fSKNode\u3092\u7d99\u627f\uff08\u3057\u305fSKEffectNode\u3092\u3055\u3089\u306b\u7d99\u627f\uff09\u3057\u305f\u30af\u30e9\u30b9\u3067\u3001\u307e\u3041\u5927\u96d1\u628a\u306b\u306f\u753b\u9762\u5358\u4f4d\u3067\u30ce\u30fc\u30c9\u3092\u53d6\u308a\u307e\u3068\u3081\u308b\u305f\u3081\u306e\u30af\u30e9\u30b9\u306e\u3088\u3046\u3067\u3042\u308b\u3002<br \/>\n\u3061\u306a\u307f\u306bSKNode\u306fUIResponder\u3092\u7d99\u627f\u3057\u3066\u3044\u308b\u306e\u3067UIKit\u95a2\u9023\u306e\u30af\u30e9\u30b9\u3068\u540c\u3058\u3088\u3046\u306b\u64cd\u4f5c\u51fa\u6765\u308b\u3093\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u308f\u308c\u308b\u3002<\/p>\n<p>[skView presentScene:scene]\u306b\u3088\u3063\u3066\u30b7\u30fc\u30f3\u304cview\u306b\u8868\u793a\u3055\u308c\u308b\u3002<br \/>\n\u3059\u3067\u306b\u8868\u793a\u4e2d\u306e\u30b7\u30fc\u30f3\u304c\u3042\u308c\u3070\u7f6e\u304d\u63db\u3048\u3089\u308c\u308b\u3002<\/p>\n<p>\u6b21\u306bMyScene\u306e\u30bd\u30fc\u30b9\u306b\u3064\u3044\u3066\u3067\u3042\u308b\u304c\u3001\u4e2d\u8eab\u304c\u3042\u308b\u30e1\u30bd\u30c3\u30c9\u306f\u4ee5\u4e0b\u306e2\u3064\u3060\u3051\u3068\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"brush: objc; title: ; notranslate\" title=\"\">-(id)initWithSize:(CGSize)size {    \r\n    if (self = &#x5B;super initWithSize:size]) {\r\n        \/* Setup your scene here *\/\r\n        \r\n        self.backgroundColor = &#x5B;SKColor colorWithRed:0.15 green:0.15 blue:0.3 alpha:1.0];\r\n        \r\n        SKLabelNode *myLabel = &#x5B;SKLabelNode labelNodeWithFontNamed:@&quot;Chalkduster&quot;];\r\n        \r\n        myLabel.text = @&quot;Hello, World!&quot;;\r\n        myLabel.fontSize = 30;\r\n        myLabel.position = CGPointMake(CGRectGetMidX(self.frame),\r\n                                       CGRectGetMidY(self.frame));\r\n        \r\n        &#x5B;self addChild:myLabel];\r\n    }\r\n    return self;\r\n}\r\n\r\n-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {\r\n    \/* Called when a touch begins *\/\r\n    \r\n    for (UITouch *touch in touches) {\r\n        CGPoint location = &#x5B;touch locationInNode:self];\r\n        \r\n        SKSpriteNode *sprite = &#x5B;SKSpriteNode spriteNodeWithImageNamed:@&quot;Spaceship&quot;];\r\n        \r\n        sprite.position = location;\r\n        \r\n        SKAction *action = &#x5B;SKAction rotateByAngle:M_PI duration:1];\r\n        \r\n        &#x5B;sprite runAction:&#x5B;SKAction repeatActionForever:action]];\r\n        \r\n        &#x5B;self addChild:sprite];\r\n    }\r\n}<\/pre>\n<p>\u307e\u305a\u3001-(id)initWithSize:(CGSize)size\u3067\u3042\u308b\u304c\u3001\u3053\u308c\u306fViewController.m\u3067\u547c\u3093\u3067\u3044\u308bsceneWithSize\u304b\u3089\u5185\u90e8\u7684\u306b\u547c\u3070\u308c\u308b\u3002<br \/>\n\u3084\u3063\u3066\u308b\u3053\u3068\u306f\u7c21\u5358\u3067\u3001\u80cc\u666f\u8272\u3092\u6307\u5b9a\u3057\u3066\u30e9\u30d9\u30eb\uff08SKLabelNode\uff09\u3092\u3072\u3068\u3064\u8ffd\u52a0\u3057\u3066\u308b\u3060\u3051\u3067\u3042\u308b\u3002<br \/>\n\u30e9\u30d9\u30eb\u306e\u64cd\u4f5c\u306b\u3064\u3044\u3066\u306f\u898b\u305f\u307e\u3093\u307e\u5206\u304b\u308a\u3084\u3059\u3044\u3002<br \/>\n\u3061\u306a\u307f\u306bSKLabelNode\u3082SKNode\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u3067\u3042\u308b\u3002<\/p>\n<p>SKColor\u306b\u3064\u3044\u3066\u306f\u300c\u3046\u308f\u3001\u307e\u305f\u65b0\u3057\u3044\u8272\u30af\u30e9\u30b9\u304b\u300d\u3068\u601d\u3046\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u5b9f\u969b\u306f\u5358\u306a\u308b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30de\u30af\u30ed\u3067\u3042\u308b\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">#if TARGET_OS_IPHONE\r\n#define SKColor UIColor\r\n#else\r\n#define SKColor NSColor\r\n#endif<\/pre>\n<p>\u6b21\u306b\u3001-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event\u3067\u3042\u308b\u304c\u3001UIView\u306a\u3069\u3068\u540c\u3058\u304f\u30bf\u30c3\u30c1\u30a4\u30d9\u30f3\u30c8\u3092\u53d7\u3051\u53d6\u308b\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u3042\u308b\u3002<\/p>\n<p>\u898b\u3069\u3053\u308d\u306f2\u3064\u3042\u3063\u3066\u3001\u307e\u305a\u306f[SKSpriteNode spriteNodeWithImageNamed:@&#8221;Spaceship&#8221;]\u306e\u90e8\u5206\u3060\u308d\u3046\u3002<br \/>\n\u305f\u3063\u305f1\u884c\u3067\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30b9\u30d7\u30e9\u30a4\u30c8\u30ce\u30fc\u30c9\u306e\u751f\u6210\u304c\u53ef\u80fd\u3068\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u3053\u308c\u306f\u697d\u3060\u3002<br \/>\n\u3082\u3061\u308d\u3093SKSpriteNode\u3082SKNode\u306e\u30b5\u30d6\u30af\u30e9\u30b9\u3067\u3042\u308b\u3002<\/p>\n<p>\u3082\u30461\u3064\u306e\u898b\u3069\u3053\u308d\u306fSKAction\u95a2\u9023\u306e\u90e8\u5206\u3060\u308d\u3046\u3002<br \/>\n\u6587\u5b57\u901a\u308a\u30ce\u30fc\u30c9\u306e\u52d5\u4f5c\u3092\u8868\u3059\u30af\u30e9\u30b9\u3067\u3001\u5185\u90e8\u7684\u306b\u306f\u30b7\u30fc\u30f3\u306b\u914d\u7f6e\u3057\u305f\u30ce\u30fc\u30c9\u304c\u51e6\u7406\u3055\u308c\u308b\u5ea6\u306b\u3001\u305d\u306e\u30ce\u30fc\u30c9\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u30a2\u30af\u30b7\u30e7\u30f3\u304c\u8a55\u4fa1\u3055\u308c\u308b\u3068\u3044\u3046\u4ed5\u7d44\u307f\u306b\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u3064\u307e\u308a\u30b7\u30fc\u30f3\u306b\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u30ce\u30fc\u30c9\uff08\u3082\u3057\u304f\u306f\u3053\u308c\u304b\u3089\u30b7\u30fc\u30f3\u306b\u8ffd\u52a0\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u30ce\u30fc\u30c9\uff09\u306b\u4e00\u5ea6\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u8a2d\u5b9a\u3057\u305f\u3089\u3001\u3042\u3068\u306f\u81ea\u52d5\u7684\u306b\u305d\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u304c\u5b9f\u884c\u3055\u308c\u308b\u3002<\/p>\n<p>\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u307e\u305a\u3001[SKAction rotateByAngle:M_PI duration:1]\u30671\u79d2\u3067180\u5ea6\u56de\u8ee2\u3059\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u751f\u6210\u3057\u3066\u3044\u308b\u3002<br \/>\n\u6b63\u306e\u89d2\u5ea6\u3067\u53cd\u6642\u8a08\u56de\u308a\u3001\u8ca0\u306e\u89d2\u5ea6\u3067\u6642\u8a08\u56de\u308a\u3068\u306a\u308b\u3002<br \/>\nduration\u3092\u79d2\u5358\u4f4d\u3067\u6307\u5b9a\u3059\u308b\u3053\u3068\u304b\u3089\u3082\u5206\u304b\u308b\u304c\u3001\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u901f\u5ea6\u306ffps\u306b\u4f9d\u5b58\u3057\u3066\u3044\u306a\u3044\u3002<br \/>\n\u3064\u307e\u308afps\u304c\u4f4e\u304f\u306a\u308c\u3070\u30a2\u30af\u30b7\u30e7\u30f3\u306f\u30ab\u30af\u30ab\u30af\u306b\u306f\u306a\u308b\u304c\u3001\u6307\u5b9a\u3055\u308c\u305fduration\u3067\u6307\u5b9a\u3055\u308c\u305f\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u884c\u3046\u3088\u3046\u306b\u52d5\u4f5c\u3059\u308b\u3002<br \/>\n\uff08\u3068\u306f\u3044\u3063\u3066\u3082\u3001\u5b9f\u969b\u306b\u306ffps\u304c\u6975\u7aef\u306b\u4e0b\u304c\u308b\u307b\u3069\u91cd\u3044\u5834\u9762\u3067\u306f\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u5b9f\u884c\u3082\u305d\u308c\u306a\u308a\u306b\u5f71\u97ff\u3092\u53d7\u3051\u308b\u306f\u305a\u3067\u3042\u308b\u3002\uff09<\/p>\n<p>\u6b21\u306b\u3001[sprite runAction:[SKAction repeatActionForever:action]]\u3067\u30011\u79d2\u3067180\u5ea6\u56de\u8ee2\u3059\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u6c38\u9060\u306b\u7e70\u308a\u8fd4\u3059\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u751f\u6210\u3057\u3001\u30ce\u30fc\u30c9\u306b\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u3002<br \/>\n\u3053\u308c\u304b\u3089\u5206\u304b\u308b\u3068\u304a\u308a\u3001\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u7e70\u308a\u8fd4\u3059\u305f\u3081\u306b\u306f\u3001\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306a\u3069\u3067\u8a2d\u5b9a\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u5165\u308c\u5b50\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u307f\u305f\u3044\u3002<\/p>\n<p>\u3056\u3063\u3068SKAction.h\u3092\u898b\u305f\u3068\u3053\u308d\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u306f\u8272\u3005\u3042\u3063\u3066\u3001\u79fb\u52d5\u3001\u56de\u8ee2\u3001\u62e1\u7e2e\u3001\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8\u3001\u8907\u6570\u306e\u753b\u50cf\u3092\u5207\u66ff\u3048\u308b\u4e8b\u306b\u3088\u308b\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3001\u97f3\u306e\u518d\u751f\u3001\u30d6\u30ed\u30c3\u30af\uff08\u3044\u308f\u3086\u308b\u30af\u30ed\u30fc\u30b8\u30e3\u3084\u30e9\u30e0\u30c0\u5f0f\u306e\u3088\u3046\u306a\u3082\u306e\uff09\u306e\u5b9f\u884c\u306a\u3069\u304c\u3042\u308b\u3002<br \/>\n\u3055\u3089\u306b\u3053\u308c\u3089\u3092\u7e70\u308a\u8fd4\u3057\u305f\u308a\u3001\u9806\u306b\u5b9f\u884c\u3059\u308b\u3088\u3046\u306a\u30a2\u30af\u30b7\u30e7\u30f3\u3082\u4f5c\u6210\u51fa\u6765\u308b\u3002<\/p>\n<p>\u7c21\u5358\u306a\u30b2\u30fc\u30e0\u306a\u3089\u3001\u307b\u3068\u3093\u3069\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u8a18\u8ff0\u3060\u3051\u3067\u4f5c\u308c\u305d\u3046\u306a\u6c17\u304c\u3059\u308b\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u3053\u3053\u307e\u3067\u3002<br \/>\n\u30bf\u30a4\u30c8\u30eb\u306b\u300c\u305d\u306e1\u300d\u3068\u4ed8\u3044\u3066\u308b\u901a\u308a\u3001\u300c\u305d\u306e2\u300d\u300c\u305d\u306e3\u300d\u3068\u7d9a\u3051\u308b\u3064\u3082\u308a\u3067\u3042\u308b\u3002<\/p>\n<p>\u300c\u305d\u306e2\u300d\u3067\u7269\u7406\u30a8\u30f3\u30b8\u30f3\u306b\u3064\u3044\u3066\u3001\u300c\u305d\u306e3\u300d\u3067\u30d1\u30fc\u30c6\u30a3\u30af\u30eb\u306b\u3064\u3044\u3066\u7c21\u5358\u306b\u898b\u3066\u3044\u3053\u3046\u304b\u306a\u3068\u601d\u3063\u3066\u3044\u308b\u3051\u3069\u3001\u9577\u304f\u306a\u308a\u305d\u3046\u306a\u3089\u5206\u5272\u3059\u308b\u304b\u3082\u3002<\/p>\n","protected":false},"author":1,"featured_media":3074,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[413,156,468],"class_list":["post-3068","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-ios","tag-objective-c","tag-spritekit"],"_links":{"self":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/3068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/comments?post=3068"}],"version-history":[{"count":0,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/posts\/3068\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/media\/3074"}],"wp:attachment":[{"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/media?parent=3068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/categories?post=3068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/peta.okechan.net\/blog\/wp-json\/wp\/v2\/tags?post=3068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}