Hello, I am making a fairly common begginer game. Where enemy nodes drop down from the top of the view. My only problem is they drop down outside the view, is there a way to set the x coordinates of the SKSpriteNodes to stay in the view its in? This is the code I have now... I have the " - 30 " with the intent of keeping it withing the width of the screen as it falls down. But it still appears outside of the screen...
func spawnEnemys() {
let enemy = SKSpriteNode(imageNamed: "Twister")
let minimumValue = self.size.width/8
let maximumValue = self.size.width - 30
let spawnPoint = UInt32(maximumValue - minimumValue)
enemy.position = CGPoint(x: CGFloat(arc4random_uniform(spawnPoint)), y: self.size.height)
let enemyAction = SKAction.moveToY(-300, duration: 3.0)
enemy.runAction(SKAction.repeatActionForever(enemyAction))
self.addChild(enemy)