I am running into a problem with my SKView where I am trying to create the illusion of a black circle closing in on my character and then the black circle opening up of the character in a new location. After looking stuff up it appears to be called an oval iris transition. My ViewController looks like this:
import UIKit
import SceneKit
import SpriteKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let scene = GameScene(size: view.bounds.size)
let skView = view as! SKView
skView.showsFPS = true
skView.showsNodeCount = true
skView.ignoresSiblingOrder = true
scene.scaleMode = .ResizeFill
skView.presentScene(scene)
}
override func prefersStatusBarHidden() -> Bool {
return true
}
}
I think this code is working fine, but when I create the GameScene the problems start. I will only show the important parts of the class, since it gets pretty extensive.
//View Did Load
override func didMoveToView(view: SKView) {
let backgroundImage = SKSpriteNode(imageNamed: "ground")
backgroundImage.size = self.scene!.size
backgroundImage.zPosition = -1
backgroundImage.position = CGPoint(x: frame.size.width/2, y: frame.size.height/2)
backgroundImage.zPosition = -1
addChild(backgroundImage)
moveJoystick = SKView(frame: CGRect(x: 0, y: size.height - size.width * 0.2, width: size.width * 0.2, height: size.width * 0.2))
moveJoystick.layer.backgroundColor = SKColor.blackColor().CGColor
moveJoystick.layer.borderColor = SKColor.blueColor().CGColor
moveJoystick.layer.borderWidth = 25
moveJoystick.alpha = 1
self.view?.addSubview(moveJoystick)
attackJoystick = SKView(frame: CGRect(x: size.width * 0.8, y: size.height - size.width * 0.2, width: size.width * 0.2, height: size.width * 0.2))
attackJoystick.backgroundColor = UIColor.redColor()
attackJoystick.alpha = 0.25
self.view?.addSubview(attackJoystick)
}
This code ends up creating two views. The moveJoystick view has a blue outline and a grey/white interior. The attackJoystick has a faint grey/white interior because of the the alpha. This shows that only the borderColor property is correctly changing.
QUESTION: I am wondering if there is anyway to change the background color of my SKViews?