我正在尝试修改我已经添加到 SKNode 的 SKShapeNode。
这是我将 SKNode 添加到屏幕并将 SKShapeNode 附加到它的代码。现在我正在尝试修改该特定 SKShapeNode 的颜色,但我不确定该怎么做。有什么建议吗?
SKNode *dot = [SKNode node];
SKShapeNode *circle = [SKShapeNode node];
circle.path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 20, 20)].CGPath;
circle.fillColor = [UIColor blueColor];
circle.strokeColor = [UIColor blueColor];
circle.glowWidth = 5;
[dot addChild:circle];
[self addChild:dot];
最佳答案
尝试删除所有 child 并重新添加新 child
[dot removeAllChildren];
[dot addChild:circle];
关于objective-c - 更新附加到 SKNode 的 SKShapeNode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20179937/