ios - Best way to draw a rope in sprite-kit? -


I'm playing with a sprite-kit and making some games for fun. Right now I am creating Rope 'Fly-Eye Games . A character is swinging to make Spiderman-style from the building and if he touches the ground on his game.

I have a good idea about creating everything except "Rope". After some googling I have found SKShapeNode, and how it can be drawn:

  SKShapeNode * yourline = [SKShapeNode node]; CGMutablePathRef pathToDraw = CGPathCreateMutable (); CGPathMoveToPoint (PathTodo Draw, Faucet, 100.0, 100.0); CGPathAddLineToPoint (Pathotode Draw, Faucet, 50.0, 50.0); Yourline.path = pathToDraw; [Your line set Stratcollar: [UIColor redColor]]; [Self linking child: your line];  
  1. Should I set the starting point to the letters of the current state?
  2. What is the easiest way to distract it? What will be like the real rope?

Try to answer any vague parts

1) You can use the position property of your character to define the starting point:

  SKShapeNode * yourline = [SKShapeNode node]; CGMutablePathRef pathToDraw = CGPathCreateMutable (); CGPathMoveToPoint (pathToDraw, NULL, yourCharacter.position.x, yourCharacter.position.y); CGPathAddLineToPoint (Pathotode Draw, Faucet, 50.0, 50.0); Yourline.path = pathToDraw; [Your line set Stratcollar: [UIColor redColor]]; [Self linking child: your line];  

2) Take a look at this:


Comments