I am trying to create four walls, that would surround the screen.
From GameScene I call
The code below works. But then I cannot add it as a child to GameScene, also I would like to give it an SKPhysicsBody.
My problem is figuring out the super.init. I've tried
super.init(texture: nil, color: .clear, size: CGPath(w: 0, h: 0))
super.init()
But I always get
From GameScene I call
Code Block let leftWall = MyEdge(side: Walls.left)
The code below works. But then I cannot add it as a child to GameScene, also I would like to give it an SKPhysicsBody.
My problem is figuring out the super.init. I've tried
super.init(texture: nil, color: .clear, size: CGPath(w: 0, h: 0))
super.init()
But I always get
Type of expression is ambiguous without more context
Code Block class MyEdge { let yourline = SKShapeNode() let pathToDraw = CGMutablePath() var color : SKColor var startAt : CGPoint var endAt : CGPoint var colMask : UInt32 var conMask : UInt32 var catMask : UInt32 var name : String init(side: Walls){ let whichWall = side switch whichWall { case .left: myGlobalVars.backGround!.size.height+1) startAt = CGPoint(x: 5, y: 5) endAt = CGPoint(x: 5, y: myGlobalVars.safeSceneRect.size.height-5) color = .white colMask = bodyMasks.gemMask.rawValue conMask = bodyMasks.blankMask.rawValue catMask = bodyMasks.edgeMask.rawValue name = "left" } pathToDraw.move(to: startAt) pathToDraw.addLine(to: endAt) yourline.lineWidth = 2 yourline.path = pathToDraw yourline.strokeColor = color } }
Please ignore this question. It shows why I should never be allowed to program. My code is riddled with errors everywhere; not initializing variables, misunderstanding the error msgs I was receiving, etc. etc. etc.
Above that I have to do all that BEFORE calling
Above that I have to do all that BEFORE calling
Code Block super.init(texture: nil, color: .clear, size: .zero)