I am trying to put a rectangle in my game and it isn't showing up. Here is where I declare it and other important variables.
var rect1: SKShapeNode! = SKShapeNode()
var blackColor = (SKColor(red:0.00, green:0.00, blue:0.00, alpha:1))
var screenWidth: CGFloat! = 0
var screenHeight: CGFloat! = 0
And here is where I give it its properties.
if screenWidth == 1024{
rect1 = SKShapeNode(rectOfSize: CGSizeMake(screenWidth/50, screenWidth/23))
}else if screenWidth == 568 || screenWidth == 480{
rect1 = SKShapeNode(rectOfSize: CGSizeMake(screenWidth/50, screenWidth/23))
}else{
rect1 = SKShapeNode(rectOfSize: CGSizeMake(screenWidth/50, screenWidth/23))
}
rect1.fillColor = blackColor
rect1.alpha = 0
rect1.physicsBody?.dynamic = false
rect1.physicsBody?.categoryBitMask = PhysicsCategory.rect1
rect1.physicsBody?.contactTestBitMask = PhysicsCategory.ball
rect1.physicsBody?.collisionBitMask = PhysicsCategory.None
rect1.physicsBody?.usesPreciseCollisionDetection = true
rect1.position = CGPoint(x: 924.325, y: 678.42)
self.addChild(rect1)
There is no error, but the rectangle isn't showing up. Any help would be appreciated.