Advertisement
Guest User

NonStandard

a guest
Jan 15th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // a: old position    b: new position
  2. -(void)updateDrawPath:(CGPoint)a B:(CGPoint)b
  3. {
  4.     CGMutablePathRef newPath = CGPathCreateMutable();
  5.     CGPathMoveToPoint((newPath), NULL, a.x, a.y);
  6.     CGPathAddLineToPoint(newPath, NULL, b.x, b.y);
  7.     CGPathAddPath(_lineToDraw, NULL, newPath);
  8.     _lineNode.path = _lineToDraw;
  9. }
  10.  
  11. // Creates EffectNode, add's ShapeNode. Add's Effectnode to Scene as instructed.
  12. -(void)traceObject:(SKPlanetNode *)p
  13. {
  14.     _effectNode = [[SKEffectNode alloc]init];
  15.     _lineNode = [SKShapeNode node];
  16.     _lineToDraw = CGPathCreateMutable();
  17.     CGPathMoveToPoint((_lineToDraw), NULL, p.position.x, p.position.y);
  18.    
  19.     _lineNode.path = _lineToDraw;
  20.     _lineNode.strokeColor = [SKColor whiteColor];
  21.     _lineNode.antialiased = YES;
  22.     _lineNode.lineWidth = 3;
  23.     [_effectNode addChild:_lineNode];
  24.     [self addChild:_effectNode];
  25.     _effectNode.shouldRasterize = YES;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement