jeudi 9 février 2017

How can i spawn random objects at a certain position

I'm using swift 3. For my game want to spawn a random object out of an array of 10 objects. All the objects are named: obs1, obs2, obs3, obs4,... obs10

When i type:

Obs1 = childNode(withName: "obs(arc4random_uniform(10) + 1))

My game chrashes. Does somebody know why?




Aucun commentaire:

Enregistrer un commentaire