使用CCRibbon画线

来源:互联网 发布:kc免费网络电话软件 编辑:程序博客网 时间:2024/05/25 20:00

CCRibbon is used to create line drawing effects using the image you specify for drawing paths or aimlines or trajectories.
First you create CCRibbon with width , image , length , color and fade parameters
ccColor4B myColor = ccc4(255, 255, 255, 150);

CCRibbon *ribbon = [CCRibbon ribbonWithWidth:10 image:@"green.png" length:10.0 color:myColor fade:0.7f];

Then we add it as a child:

[self addChild:ribbon z:8];

If you run the application now you will not see anything because you didn’t add any points yet to the CCRibbon so lets add 2 points

[
ribbon addPointAt:ccp(10,10) width:10];

[
ribbon addPointAt:ccp(15,15) width:10];

You cannot remove individual points but you can remove the CCRibbon from its parent

[
self removeChild:ribbon cleanup:YES];

Now Run and watch the results


原创粉丝点击