0

I'm a newbie for Sprite-kit. Here is my question below, 1) I add a Color Sprite in GameScene.sks which named as "SpriteName" 2) I want to add a physicsBody for "SpriteName"(the color sprite) in Scene.swift or GameViewController.swift.

So how could I do ?

Jerry Zhao
  • 273
  • 3
  • 14
  • Please read how to ask a good question: http://stackoverflow.com/help/how-to-ask – Phate01 Apr 01 '15 at 15:10
  • You can use [that answer](http://stackoverflow.com/questions/29181419/scene-created-in-sprite-kit-level-editor-is-not-working). It's not perfect, but hopefully it will work for you. – Burundanga Apr 01 '15 at 21:57
  • @Phate01 Hi, I'm really don't know what's wrong with my question, could you please explain it? I would be grateful. – Jerry Zhao Apr 02 '15 at 12:17
  • @Burundanga Many Thanks, I found you had use programming rather than .sks :) BTW, I just saw the video "608_hd_best_practices_for_building_spritekit_games" and thought .sks would be an easier way for anyone like me(An entirely beginner). – Jerry Zhao Apr 02 '15 at 12:28
  • @JerryZhao it should be, in my modest opinion, a bit more detailed, perhaps with some code that generates the problem, or some efforts, no matter if completely wrong. As you have written it, it sounds like you want some ready-to-use code by us, and that's not the site purpose. Last but not least you should better format your question. That's why I linked you the help center page, because everyone learned from there how the site works, often not completely (me first of all) – Phate01 Apr 02 '15 at 12:43
  • Many thanks @Phate01, actually I had some code but I'm too lazy(or shame of it) to show them, that's my fault. I'll do better in subsequent question. Thank you for correct me:) – Jerry Zhao Apr 02 '15 at 22:51

1 Answers1

0

I've found the way with this tutorial below: http://www.techotopia.com/index.php/An_iOS_8_Swift_Sprite_Kit_Level_Editor_Game_Tutorial#Creating_the_Archery_Scene

and here is the key line in above example.

let archeryScene = ArcheryScene(fileNamed: "ArcheryScene")

The first "ArcheryScene" is the .swift ,and the latter is the .sks this line means combine these two difference files with the exactly name.

and below is the way to call .sks node in .swift

let welcomeNode = childNodeWithName("welcomeNode")
Jerry Zhao
  • 273
  • 3
  • 14