Friday Discount - Lifetime Access for $20!!!! - Click Here!

Stick Node to Node – Story Tellers iOS Starter Kit Documentation

StickNodeToNode can be called as an Event but you can also include this dictionary in the main group of your page. For example….

Stick SKNode to SKNode

Inside the StickNodeToNode dictionary you will create sub-dictionaries to define the terms of how each node (or array of nodes) will stick to another node.  See the image below for reference.

Stick SKNode to SKNode Swift 2

Required entries are…

  • StickNode – which can be a String or Array to define multiple nodes to move in relation to another node
  • ToNode – the node to stick to.
  • ToNodePhone – if the device is a phone, you can set an alternate node to stick to. This property is ignored on the iPad, and if it is excluded, the phone will use the ToNode property.

Optional entries are….

  • Offset – a value in { x, y } format. The default for Offset is {0,0} which means the StickNode(s) will not be offset at all on the x or y axis.
  • Parallax – a value in { x, y } format. The default for Parallax is {1, 1}, which means the StickNode(s) will move 100% on the x and y axis in relation to the ToNode. The x and y values you enter will each multiply the position of the StickNode after any offset values.
  • UseCurrentOffset – If you set this value to YES, then delete the Offset value and the kit will figure out the current difference of the StickNode and ToNode nodes and use that as the offset. This is a VERY useful property if you layout all your nodes exactly how you want initially in the Scene editor.

For example, in the screenshot below notice Slot0, Slot1, Slot2, Slot3 are all using UseCurrentOffset set to YES. So these placeholders (for item icons we can collect in the scene) will always be in the bottom left corner of the screen.

Stick SKNode to SKNode Swift 2

 

You can also Parent one node inside of another to move them together. Notes on that here.

Stick SKNode to SKNode Swift 2

 

 

 

If you stumbled onto this article, it is part of our documentation for the Story Tellers iOS Starter Kit 2. The kit enables you to make children’s book apps and games without writing any code! But it is Swift 2 based and compatible with iOS9 (or higher) and Xcode 7 (or higher), so kit buyers can even extend the functionality to fit their needs further. Some of what we cover in the kit documentation may apply to Xcode in general, so this article could be worth a read even if you aren’t a user. You can purchase Lifetime Updates the kit here, or subscribe Yearly to CartoonSmart and get the latest version, plus access to all of our other kits / tutorials.

We’ve also created an iBook to document the very latest properties in the kit, so be sure to download that as well.




Know what an affiliate program is? You make money just by sharing links to our site! Win. Win.

Earn when you refer any buyer here! 30 day tracking. Commissions are 33%-50% and recur on subscription products!