0
我想畫一個圓圈,從圓圈中心,這也是兩倍長圓的半徑iOS的圓和線在雪碧包
我的輸出繪圖與線旁邊的圓圈有一條線。
- (void)setupMainBall {
mainBall = [self makeMainBall];
mainBall.position = CGPointMake(self.size.width/2, self.size.height/2);
mainBall.zPosition = 3;
[self addChild:mainBall];
[mainBall addChild:[self makeCanon]];
}
-(SKShapeNode *)makeMainBall {
SKShapeNode *theMainBall = [[SKShapeNode alloc] init];
CGMutablePathRef myPath = CGPathCreateMutable();
CGPathAddArc(myPath, NULL, 0, 0, 10, 0, M_PI*2, YES);
theMainBall.fillColor = [SKColor blueColor];
theMainBall.path = myPath;
theMainBall.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:theMainBall.frame.size.width/2];
return theMainBall;
}
-(SKSpriteNode *)makeCanon {
canon = [SKSpriteNode spriteNodeWithColor:[SKColor blackColor] size:CGSizeMake(3, 20)];
canon.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:canon.frame.size];
return canon;
}