Im trying to Create a game in which a projectile is launched at a random angle. To do this I need to be able to generate two random Int's, I looked up some tutorials and came up with this:
var random = CGFloat(Int(arc4random()) % 1500)
var random2 = CGFloat(Int(arc4random()) % -300)
self.addChild(bullet)
bullet.physicsBody!.velocity = CGVectorMake((random2), (random))
It worked for a while but now it just crashes.
Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire