1

是否有可能在 SKSpriteNode 上创建框架?

我想从这里修改 SKSpriteNode:

对此:

当我初始化 SKSpriteNode 时,我设置了这个精灵的颜色: SKSpriteNode *button = [SKSpriteNode spriteNodeWithColor:[UIColor yellowColor] size:CGSizeMake(70, 70)];

是否可以向该节点添加框架?

提前致谢 :)

4

1 回答 1

0

这是启用“showsNodeFrames”时我在Kobold Kit中所做的:

if ([KKView showsNodeFrames])
{
    SKShapeNode* shape = [SKShapeNode node];
    CGPathRef path = CGPathCreateWithRect(self.frame, nil);
    shape.path = path;
    CGPathRelease(path);
    shape.antialiased = NO;
    shape.lineWidth = 1.0;
    shape.strokeColor = [SKColor orangeColor];
    [self addChild:shape];
}

基本上它从节点的框架创建一个 SKShapeNode 并将其添加到节点。在你的情况下selfbutton.

于 2014-03-23T17:30:20.630 回答