I would like for enemies to spawn on the X axis, so far I got
enemy?.position = CGPoint(x: CGFloat(arc4random_uniform(UInt32(self.frame.width))), y: self.frame.maxY)
This works, howether I would like for them to spawn within the screen and not get cut out when spawning on x = 0 or the maximum x
I have also tried x: 100 + CGFloat(arc4random_uniform(Uint32(self.frame.width - 100)))
This give me an error, If the width of my screen is lets say 1000, how do I make a random number between 100 and 900, while also automatically finding the width of the screen.
I am also using SpriteKit