iphone - How do the slicing effects work in the Fruit Ninja game? -


does know how slicing effects work in fruit ninja game?

screenshot of fruit ninja game

or other way achieve similar effect?

how swipe point @ how draw line on please ....

i draw many lines give slicing effect , removed points simultaneously mutable array put point draw line

code:-

-(void)init     {      [self checkallarray];      [self schedule:@selector(removepoints:) interval:0.0001f];     } -(void)checkallarray {     if (naughtytoucharray==null)         naughtytoucharray=[[nsmutablearray alloc] init];     else     {         [naughtytoucharray release];         naughtytoucharray=nil;         naughtytoucharray=[[nsmutablearray alloc] init];     } }  -(void)draw {     glenable(gl_line_smooth);     glcolor4ub(255, 255, 255, 255); //line color      //gllinewidth(2.5f);     for(int = 0; < [naughtytoucharray count]; i+=2)     {         cgpoint start = cgpointfromstring([naughtytoucharray objectatindex:i]);         cgpoint end = cgpointfromstring([naughtytoucharray objectatindex:i+1]);                 ccdrawline(start, end); // line 1         ccdrawline(ccp(start.x-2,start.y-2),ccp(end.x-2,end.y-2));// line 2         ccdrawline(ccp(start.x-4,start.y-4),ccp(end.x-4,end.y-4));// line 3         ccdrawline(ccp(start.x-6,start.y-6),ccp(end.x-6,end.y-6));// line 4         ccdrawline(ccp(start.x-8,start.y-8),ccp(end.x-8,end.y-8));// line 5     } }  - (void)cctouchesmoved:(nsset *)touches withevent:(uievent *)event  {     cgpoint new_location = [touch locationinview: [touch view]];     new_location = [[ccdirector shareddirector] converttogl:new_location];     cgpoint oldtouchlocation = [touch previouslocationinview:touch.view];     oldtouchlocation = [[ccdirector shareddirector] converttogl:oldtouchlocation];     [naughtytoucharray addobject:nsstringfromcgpoint(new_location)];     [naughtytoucharray addobject:nsstringfromcgpoint(oldtouchlocation)]; }  -(void)removepoints:(cctime *)tm {     if ([naughtytoucharray count]>0)     {         [naughtytoucharray removeobjectatindex:0];     } }  -(void)dealloc {     //nslog(@"deallocing lightning\n");     [self removeallchildrenwithcleanup:yes];     [super dealloc]; } 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -