I was writing code today and I stumbled across a problem with my random number generator. I am trying to make a generator much like the one in Fruit Ninja, I am also writing in swift. Here is a snippet of my code:
var rand_x = arc4random()
var rand_y = arc4random()
node!.position = CGPoint(x: rand_x, y: rand_y)
My problem is I am getting the error:
Cannot find an initializer for type 'CGPoint' that accepts an argument list of type '(x: UInt32, y: UInt32)'
Any tips how to fix this? Thanks!
Aucun commentaire:
Enregistrer un commentaire