Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Code Project Members

I am in dire need of some help, please see below. I am having trouble finding a solution!

iPhone 6 Demo App
Using SpriteKit

What I would like to do is to attach two SKSpriteNodes together.

Node 1 square 100x100
Node 2 square 50x50

I would like the two nodes to be independent within the GameScene, I would like to be able to drag and drop each node within the scene, but if I drag node 2 over Node 1 (top left corner) and release my finger, Node 2 anchors to Node 1 in the top left corner. Now when I move Node 2, Node 1 moves with it.

If I press node 2 again, the anchoring is removed and the 2 Nodes are independent again.

I would like the same to happen for each corner of Node 1.

I would like to be able add additional Nodes to the scene with the same functionality. There fore each Node will have its own class.

I hope that makes sense.

can one of you guys help with sample code or direction on how this can be achieved?

Thanks in advance!
Posted

1 solution

Forgot to add, both Nodes need to be affected by Physics
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900