2015-01-24 8 views
-1

플레이어가 게임의 필수 점수를 얻으면 다음 단계로가는 방법에 대해 알고 싶습니다.플레이어가 필요한 점수를 얻었을 때 다음 단계로 이동하는 방법

예를 들어 필요한 점수는 100입니다. 점수에 도달하면 그는 다음 단계로 진행합니다. 이 코드를 시작하는 방법을 모릅니다. 아이디어를 좀주세요.

플레이어의 점수를 표시하는 코드입니다. 플레이어가 100이되면, 다음 단계로 잠금을 해제하면 재생할 수 있습니다.

// score 
     Paint paint = new Paint(); 
     paint.setColor(Color.BLUE); 
     paint.setAntiAlias(true); 
     paint.setFakeBoldText(true); 
     paint.setTextSize(15); 
     paint.setTextAlign(Align.LEFT); 
     canvas.drawText("Score :" + score, 3 * sx/4, 20, paint); 
     // exit 
     canvas.drawBitmap(exit, 0, 0, null); 
     if (sound == 1) { 
      mp1.start(); 
      mp1.setLooping(true); 
     } 

내 LevelForm의 코드

public class LvlForm1 extends Activity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_lvl_form1); 
} 

public void action(View v){ 
int id = v.getId(); 
if (id==R.id.btnluneta1){ 
Intent intent= new Intent(this,NewGame1.class); 
startActivity(intent); 
} 
if (id==R.id.btnvigan1){ 
    Intent intent= new Intent(this,NewGame2.class); 
    startActivity(intent); 
} 
if (id==R.id.btnleyte1){ 
    Intent intent= new Intent(this,NewGame3.class); 
    startActivity(intent); 
} 
if (id==R.id.btnpaoay1){ 
    Intent intent= new Intent(this,NewGame4.class); 
    startActivity(intent); 
} 
if (id==R.id.btnbataan1){ 
    Intent intent= new Intent(this,NewGame5.class); 
    startActivity(intent); 
} 
if (id==R.id.btnback5){ 
    Intent intent= new Intent(this,NormalMode.class); 
    startActivity(intent); 
} 
} 
@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
    // Inflate the menu; this adds items to the action bar if it is present. 
    getMenuInflater().inflate(R.menu.lvl_form1, menu); 
    return true; 

} 

} 

답변

0

귀하의 질문은 매우 게임이 실행되고 어떻게이 켜져 기본 게임 인 경우 우리가 알고하지 않는 모호한, 또는 진짜 시간 등 당신의 제한된 정보에서

, 당신은 예를

private bool check(int level){ 
    if(level >=100) 
    //do what you need . . . . 
} 
012에 대한 검사 방법을 넣을 수

게임에서 일부 이벤트 (예 : 플레이어가 포인트를 얻을 때마다)를 실행하여이 체크를 실행합니다.

+0

내 게임 코드를 게시해야합니까? –

+0

네, 질문에 대한 정확한 답변을 얻으려면 관련 부분을 게시하고 정확히 어떻게하려고하는지 설명하십시오. –