How can one draw a line in Sprite-kit? For example if I want to draw a line in cocos2d, I could easily using ccDrawLine();
ccDrawLine();
Is there an equivalent in sp
Here is my Swift 4 function to add a Line between two points:
func drawLine(from: CGPoint, to: CGPoint) { let line = SKShapeNode() let path = CGMutablePath() path.addLines(between: [from, to]) line.path = path line.strokeColor = .black line.lineWidth = 2 addChild(line) }
Hope it helps!!