Draw a Line Sprite Between Two Points made by Sprites in Cocos2d

前端 未结 3 1766
不知归路
不知归路 2021-01-25 06:35

I\'ve been trying to draw a sprite line between 2 points made by sprites with mouse events on Xcode.

I have been following the steps given on a forum in this link: cocos

3条回答
  •  自闭症患者
    2021-01-25 06:52

    Using Cocos2D v3.x this works:

    in -(void)update:(CCTime)delta{} you do this:

    [self.drawnode drawSegmentFrom:ccp(50,100) to:ccp(75, 25) radius:3 color:self.colorDraw];
    

    The self.drawnode and self.colorDraw properties are initialized like this, maybe inside -(void)onEnter{} :

    self.drawnode = [CCDrawNode node];
    self.colorDraw = [CCColor colorWithCcColor3b:ccRED];
    [self addChild:self.drawnode];
    

提交回复
热议问题