Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

merge two sprite nodes in sprite kit

I am designing a sprite kit game where I want to merge two sprite nodes (rect shapes) together and then act and move them as one sprite node ?

I've been searching lot and I didn't find results

Is that possible in sprite kit ? and how can I do it ?

I'll appreciate any help, Thanks

like image 876
Omar Albeik Avatar asked Jul 27 '14 23:07

Omar Albeik


1 Answers

Add one node as a child of the other. If you set it's node2.physicsbody.dynamic=NO; it will move as a single node. There will be separate physicsbodies but you can set them to the same category bitmask.

The answer linked here may help with notation: How to detect contact on different areas of a physicsbody

like image 197
meisenman Avatar answered Nov 14 '22 22:11

meisenman