以下是示例代码:
SKNode* node = [SKNode node];
node.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
[self addChild: node];
SKSpriteNode *sprite1 = [SKSpriteNode spriteNodeWithImageNamed:@"Spaceship"];
sprite1.position = CGPointMake(-900.0, -900.0);
[node addChild: sprite1];
SKSpriteNode *sprite2 = [SKSpriteNode spriteNodeWithImageNamed:@"Spaceship"];
sprite2.position = CGPointMake(900.0, 900.0);
[node addChild: sprite2];
[self runAction: [SKAction sequence: @[[SKAction waitForDuration: 3.0], [SKAction runBlock:^{
SKTexture* texture = [self.view textureFromNode: node];
SKSpriteNode* ts = [SKSpriteNode spriteNodeWithTexture: texture];
ts.xScale = 1.0 / [UIScreen mainScreen].scale;
ts.yScale = 1.0 / [UIScreen mainScreen].scale;
[self addChild: ts];
}]]]];
一旦我将两个精灵彼此远离,使容器节点的累积框架变大,我就会变黑纹理?