왜 SKSpriteNode node.frame.size.width가 node.size.width보다 작습니까?
여기 은 아마 당신이 당신의 자신의 이미지를 삽입해야합니다, 예를 들어 코드왜 SKSpriteNode node.frame.size.width가 node.size.width보다 작습니까?
- (void)DrawRect:(SKSpriteNode *)node
{
SKShapeNode *rect = [[SKShapeNode alloc] init];
CGMutablePathRef myPath = CGPathCreateMutable();
CGPathAddRect(myPath, nil, node.frame);
rect.path = myPath;
rect.lineWidth = 1;
rect.strokeColor = [SKColor whiteColor];
rect.glowWidth = 0;
[self addChild:rect];
}
// 여기에
-(void) DrawSpriteNode
{
SKTextureAtlas *atlas = [SKTextureAtlas atlasNamed:@"character"];
SKSpriteNode* node = (SKSpriteNode *)[SKSpriteNode spriteNodeWithTexture:[atlas textureNamed:@"testimage.png"]];
node.position = CGPointMake(self.anchorPoint.x, self.anchorPoint.y);
NSLog(@"node frame width x :%f",node.frame.size.width);
NSLog(@"node frame height y :%f",node.frame.size.height);
NSLog(@"node width y :%f",node.size.width);
NSLog(@"node height y :%f",node.size.height);
node.anchorPoint = CGPointMake(0.5, 0.5);
[self DrawRect: node];
[self addChild:node];
}