2010-12-03 1 views
0

私はiphone.Iでゲームを開発することに新しいです(そして私は新しいソフトウェア開発フィールドです)。果物Ninga、vegのようなカット効果を開発する必要があります武士とカットカットブームゲーム。私はこれを行う方法を知っていません。私はそれについて多くを検索し、彼らは距離と角度のベクトルを見つけて、それを4x4マトリックスに適用すると言う...(または)彼らは、彼らが言ったように、私は描画するためにOpenGLを使用しますが、それはそうではありません。誰もそれをするのに役立ちます....切削効果を開発するためのサンプルコードを与える....事前に感謝.. ..私はfruit ninga、veg samurai game in iphoneのようなカットエフェクトを開発する必要があります

ここは私の便宜のための私の引き出し機能です..... - (空)引く {

if([_points count] > 0) 
{ 
    glDisable(GL_TEXTURE_2D); 
    glDisableClientState(GL_COLOR_ARRAY); 
    glDisableClientState(GL_TEXTURE_COORD_ARRAY); 


    glEnable(GL_TEXTURE_2D); 
    glEnableClientState(GL_COLOR_ARRAY); 
    glEnableClientState(GL_TEXTURE_COORD_ARRAY); 
    glEnable(GL_LINE_SMOOTH); 
    glColor4f(20, 20, 20, 20); 


    for(int i=0;i<[_points count]-1;i++) 
    { 
     if(i<=1) 
     { 
      glLineWidth(5.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>1 && i<=2) 
     { 
      glLineWidth(5.5f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>2 && i<=3) 
     { 
      glLineWidth(6.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>3 && i<=4) 
     { 
      glLineWidth(7.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>4 && i<=5) 
     { 
      glLineWidth(8.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>5 && i<=6) 
     { 
      glLineWidth(9.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>6 && i<=7) 
     { 
      glLineWidth(10.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>7 && i<=8) 
     { 
      glLineWidth(11.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>8 && i<=9) 
     { 
      glLineWidth(12.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>9 && i<=10) 
     { 
      glLineWidth(13.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>10 && i<=11) 
     { 
      glLineWidth(14.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>11 && i<=12) 
     { 
      glLineWidth(15.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
     if(i>12 && i<=13) 
     { 
      glLineWidth(16.0f); 
      MovePoints *p1 = (MovePoints*)[_points objectAtIndex:i]; 
      MovePoints *p2 = (MovePoints*)[_points objectAtIndex:i+1]; 
      ccDrawLine(p1.location,p2.location); 
     } 
    } 
    [super draw]; 
} 

フェードアウトのための私の更新機能ライン - (無効)更新:(ccTime)DT { ダブル今= [[NSDate日付] timeIntervalSince1970]。あなたのコードを見ている

if(lastTimeTrailRemoved == 0) 
{ 
    lastTimeTrailRemoved = now; 
    return; 
} 

if(((now - lastTimeTrailRemoved) > 0.03f) && ([_points count] > 0)) 
{ 
    NSLog(@"removing last point"); 
    [_points removeObjectAtIndex:0]; 
    [_points removeObjectAtIndex:1]; 
    [_points removeObjectAtIndex:2]; 
    [_points removeObjectAtIndex:3]; 

    lastTimeTrailRemoved = now; 
} 

}

答えて

0

、私はいくつかの問題を参照してください。私は一歩踏み出し、より基本的なものから始めようと思います。 「最先端」の問題は、進歩している人々によって一般的に行われ、新しいもの、すばらしいものを創り出すことができるということです。ゲーム開発に関する本をお勧めしますか? Apress: Beginning iPhone Games Developmentは読みやすいです。

+0

いただきありがとうございます。 – user452815

関連する問題