0

Here's my code so far. My plan is to eventually give each variable a randomized value but when I update them in my game, but in the class I think I should create instance variables and initialize them to something.

import UIKit

class Planet: CCNode {
    var mass: Int = 0
    var radius: Int = 0
    var color:
}

I don't know how to initialize a color though. Which type would I use and what is a value I could initialize it to? Also, is this a good practice when creating a CCNode for your game? I'm not using CCSprite because I want to be able to randomly change the variables when I update them.

1 Answers1

0

Use CCColor class and +colorWithRed:green:blue:

CCSprite also allows to change its properties on runtime