我设置了一个CCNode:
CCNodeColor *node = [CCNodeColor nodeWithColor:[CCColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:0.0f]];
node.position=ccp(0,0);
node.name=@"zoomAlpha";
[self addChild:node];
哪个有效。 而不是改变它的颜色/ alpha:
CCNodeColor *nood=(CCNodeColor*)[self getChildByName:@"zoomAlpha" recursively:NO];
if(nood)
{
//i got here with a nood , but color is not changed
[nood setColor: [CCColor colorWithRed:0.6f green:0.3f blue:0.4f alpha:1.0f ]];
return;
}
为什么?
答案 0 :(得分:1)
试试这个:
[nood setColor: [CCColor3B colorWithRed:0.6f green:0.3f blue:0.4f alpha:1.0f ]];
OR
[nood setColor: [CCColor4B colorWithRed:0.6f green:0.3f blue:0.4f alpha:1.0f ]];