iOS circles and lines in Sprite Kit -
I want to draw a circle from the circle center and a line which is also twice the circle radius
My output is pulling a circle with its forward line
- (zero) setupManball {main ball = [self makemenball]; MainBall.position = CP pointmake (auto size.width / 2, self size .ight / 2); MainBall.zPosition = 3; [Self linking child: main ball]; [Add Main Ball Child: [MacConan himself]]; } - (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 manball; } - (SKSpriteNode *) Maconon {canon = [SKSpriteNode spriteNodeWithColor: [SKColor blackColor] Size: CGSizeMake (3, 20)]; Canon.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize: canon.frame.size]; Return Canon; }
Try:
SKSpriteNode * canon = [MacKenan himself]; [Add Main Ball: Canon]; Canon.position = CGExMake (Mainball.Width / 2, main body.im.width / 2);
Comments
Post a Comment