I'm developing a running game for iOS devices and have run into a problem. I created a subclass for a game tile which is 4 screen lengths long. The game tile will have some nodes which are obstacles. I have a scene which creates the player, some background decorations, and particle systems. I need to add the obstacle nodes to the physics simulation in the scene so that I can detect when they contact. I'm not sure how to do that... Is there another solution that would be simpler? Thanks in advance for your help.
Asked
Active
Viewed 165 times
0
-
Simpler than the way you're not sure about how to do? ;) I you haven't already I suggest you read through the Physics section of the programming guide, this should help what to do and how to do it: https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Physics/Physics.html – CodeSmile Dec 29 '13 at 20:20
-
@LearnCocos2d: Since I will be adding the SKSpriteNode subclass (the tile) to the scene, then I guess the obstacles would be considered in the physics simulation because they are indirectly part of the SKScene? – 67cherries Dec 29 '13 at 20:37
-
1a physics body is connected with a node, and when the node is added as child of another node so will the body be part of the world – CodeSmile Dec 30 '13 at 02:00