As I'm passing NSString
s into UIColor
s and what not, for my cocos2d application, I am storing a colour for the scene's background in a UIColor
variable, however would like to then convert the UIColor
to a CCNodeColor
variable? Obviously, the sample code below is wrong but that's where I'm at right now.
NSString *backgroundColour = [backgroundColourArray objectAtIndex:randomIndex];
CIColor *coreColour = [CIColor colorWithString:backgroundColour];
UIColor *colour = [UIColor colorWithCIColor:coreColour];
CCNodeColor *background = [UIColor colour]; // Problems arise here
Try to create CCNodeColor like this:
CCNodeColor *background = [[CCNodeColor alloc] initWithColor:[CCColor colorWithUIColor:colour]];