{"id":281,"date":"2020-10-25T22:19:25","date_gmt":"2020-10-25T22:19:25","guid":{"rendered":"http:\/\/xphone.pt\/devnotes\/?page_id=281"},"modified":"2020-10-25T22:21:03","modified_gmt":"2020-10-25T22:21:03","slug":"spritekit","status":"publish","type":"page","link":"http:\/\/xphone.pt\/devnotes\/ios\/spritekit\/","title":{"rendered":"SpriteKit"},"content":{"rendered":"\n<h4><strong>Create Scene<\/strong> (<code>SKScene<\/code>)<\/h4>\n\n\n\n<ul><li>based on size:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>let scene = GameScene(size: view.bounds.size)<\/code><\/pre>\n\n\n\n<ul><li>based on scene file (&#8220;<code>GameScene.sks<\/code>&#8221; on this case):<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>guard let scene = SKScene(fileNamed: \"GameScene\") else {\n    return\n}<\/code><\/pre>\n\n\n\n<h4>Configure Scene<\/h4>\n\n\n\n<p>Some useful properties:<\/p>\n\n\n\n<ul><li><code>showsFPS<\/code> &#8211; show frames\/second;<\/li><li><code>showsNodeCount<\/code> &#8211; show the number of nodes;<\/li><li><code>ignoresSiblingOrder<\/code> &#8211; ignore sibling order when rendering.<\/li><\/ul>\n\n\n\n<h4>Create\/Get SpriteKit View (<code>SKView<\/code>)<\/h4>\n\n\n\n<ol><li>Change view controllers&#8217;s view to <code>SKView<\/code> type (instead of <code>UIView<\/code>) on storyboard (if using it).<\/li><li>Get view as <code>SKView<\/code>:<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>let skView = view as! SKView<\/code><\/pre>\n\n\n\n<h4>Configure <code>SKView<\/code><\/h4>\n\n\n\n<p>Some useful properties:<\/p>\n\n\n\n<ul><li><code>scaleMode<\/code> &#8211; change view&#8217;s scale mode.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Create Scene (SKScene) based on size: based on scene file (&#8220;GameScene.sks&#8221; on this case): Configure Scene Some useful properties: showsFPS &#8211; show frames\/second; showsNodeCount &#8211; show the number of nodes; ignoresSiblingOrder &#8211; ignore sibling order when rendering. Create\/Get SpriteKit View (SKView) Change view controllers&#8217;s view to SKView type (instead of UIView) on storyboard (if using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":300,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/xphone.pt\/devnotes\/wp-json\/wp\/v2\/pages\/281"}],"collection":[{"href":"http:\/\/xphone.pt\/devnotes\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/xphone.pt\/devnotes\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/xphone.pt\/devnotes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xphone.pt\/devnotes\/wp-json\/wp\/v2\/comments?post=281"}],"version-history":[{"count":18,"href":"http:\/\/xphone.pt\/devnotes\/wp-json\/wp\/v2\/pages\/281\/revisions"}],"predecessor-version":[{"id":299,"href":"http:\/\/xphone.pt\/devnotes\/wp-json\/wp\/v2\/pages\/281\/revisions\/299"}],"up":[{"embeddable":true,"href":"http:\/\/xphone.pt\/devnotes\/wp-json\/wp\/v2\/pages\/300"}],"wp:attachment":[{"href":"http:\/\/xphone.pt\/devnotes\/wp-json\/wp\/v2\/media?parent=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}