How to draw a line in Sprite-kit

前端 未结 7 1101
长发绾君心
长发绾君心 2020-12-02 18:09

How can one draw a line in Sprite-kit? For example if I want to draw a line in cocos2d, I could easily using ccDrawLine();

Is there an equivalent in sp

7条回答
  •  日久生厌
    2020-12-02 18:58

    If you only want a line, sort of how people use UIViews for lines (only), then you can just use a SKSpriteNode

    SKSpriteNode* line = [SKSpriteNode spriteNodeWithColor:[SKColor blackColor] size:CGSizeMake(160.0, 2.0)];
    [line setPosition:CGPointMake(136.0, 50.0))];
    [self addChild:line];
    

提交回复
热议问题