0

Im trying to add a straight line in sprite kit, so far I haven't find any problem in my code but when I run the app the node count stays at 0 and it doesn't displays any errors. I been stuck for hours... any clues? do I have to create a separate array of coordinates for the points to work? thanks in advance.

import SpriteKit


class GameScene: SKScene {
override func didMoveToView(view: SKView) {

    var path = CGPathCreateMutable()
    var line = SKShapeNode()

    line.zPosition = 1
    line.position = CGPointMake(100, 100)
    CGPathMoveToPoint(path, nil, 0, 0)
    CGPathAddLineToPoint(path, nil, 15, 15)
    line.path = path
    line.lineWidth = 15
    line.fillColor = UIColor.blackColor()
    line.strokeColor = UIColor.blackColor()

  self.addChild(line)
}
sangony
  • 11,636
  • 4
  • 39
  • 55
  • 1
    This is more of a SpriteKit question than a CGPath question. You should put SpriteKit in the question title so people (unlike me) who know SpriteKit see it. – Duncan C Apr 26 '15 at 22:35
  • Add `scaleMode = .ResizeFill` to `didMoveToView`. – 0x141E Apr 27 '15 at 08:37

0 Answers0