I'm trying to create a game with Swift and SpriteKit and I'd like to create multiple instances of the same sprite in random positions, but I can't figure out how to do it. I considered just doing adding this code:
addChild(object)
multiple times, but this causes the app to crash. How can I solve my problem?
EDIT: I've fixed this part of the problem, but now I want to add my random sprites in random X locations. I've tried to generate random positions by executing this code:
var randomNumber = arc4random_uniform(8)
crateDuplicate.position = (CGPointMake(randomNumber, 200))
But, I get an error of "Cannot assign a value of type '(CGPoint)' to a value of type 'CGPoint'." What should I do?