⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jmps.java

📁 一个j2me的滑雪游戏
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        else {
          if(GM < 350 || GM >=800) {
            showSoftKeys();
            hideSoftKeys(5000, 20);
          }
        }
      }
      else if (GM == 1000) {  // SCORES Mode
        if (SOFT_1) {
          GM = -100; // Back (to menu)
        }
        else {
          if(GM < 350 || GM >=800) {
            showSoftKeys();
            hideSoftKeys(5000, 20);
          }
        }
      }
      else if (GF[14]) { // TUTORIAL Mode
        if (SOFT_1) {
          GM = -100; // Back (to menu)
        }
        else {
          showSoftKeys();
          hideSoftKeys(5000, 20);
        }
      }
      else if (GM >= 800) { // RANKING/RESULTS Modes
        if (SOFT_2) notifyTitle(); // Back
        if (SOFT_1) ProEvent(1048576); // OK button mapped to action key
        else {
          if(GM < 350 || GM >=800) {
            showSoftKeys();
            hideSoftKeys(5000, 20);
          }
        }
      }
      else {  // GAME (DESCENDING) Modes
        if (SOFT_1) ProEvent(1048576); // OK button mapped to action key
        else if (SOFT_2) notifyTitle(); // Back
        else if (param == KEY_0) pause();  // help
      }
		}
	}
 
  
  
//------------------------------------------------------------------------------

  public void notifyTitle() {
    Temp[0] = 0;
		GF[0] = false;
		GM = 0;
  }

	public void startGame() {
    GM = 0;
    nSel = 0;    
    ProEvent(-10);    
  }

  public void startTutorial() {
    GM = 0;
    nSel = 1;    
    ProEvent(-10);
  }

  public void startScores() {
    GM = 0;
    nSel = 2;
    ProEvent(-10);
    GF[1] = true;
  }

  public void gameOver() {
    startScores();
  }


//--------------------------------------------------------------------------------------------  
  
  public void pause() {
    if(isPaused) return;
    pausedForHelp = true;
    if(GM == 300) Draw();
    isPaused = true;
    resetKeypadState();
    repaint();
    serviceRepaints();
  }

 
//--------------------------------------------------------------------------------------------

  public void DrawHelp(Graphics g) {    
    g.setFont(NF);
    
    g.setColor(C[0]); // white
    //int x1 = 5, y1 = 29, x2 = 116, y2 = 89, left_x = 5, space_y = 13;  // GX10
    int x1 = 4, y1 = 27, x2 = 117, y2 = 89, left_x = 5, space_y = 13;  // 7210
    
    g.fillRect(x1, y1, x2-x1, y2-y1); // GX10
    g.setColor(0); // black
    g.drawRoundRect(x1, y1,  x2-x1, y2-y1, 7, 7); 
    
    //g.drawString(strSpecific[?], center, top, CENTER_TOP);
    
    for (int i=0; i<4; i++) {
      if (helpFirstScreen) {        
        g.drawString(strSpecific[40+i], x1+left_x, y1+7+space_y*i, LEFT_TOP);
      }
      else {        
        g.drawString(strSpecific[44+i], x1+left_x, y1+7+space_y*i, LEFT_TOP);
      }
    }
    setSoftLabels(main.txt.getBundle("cmdContinue")[0], null);
    showSoftKeys();
  }
  
  
  
//------------------------------------------------------------------------------

	public void ProEvent(int OnKey)
	{	
    int i, j, x, y;
    
		Key[0] = Key[3] | OnKey | getKeypadState();

		Key[1] = Key[0] & ~Key[2];
		Key[2] = Key[0];
		Key[3] = 0;

    if( GF[14] && GM > 200 ){ // How To (..)
			Key[0] = 0;
			Key[1] = 0;
		}

    //--------------------------------------------------------------------------
		if( GM == 0 ){
						
			if( ( Key[1] & 131076 ) != 0 ){
				nSel--;
				if( nSel < 0 ) nSel = 2;
			}
			
			if( ( Key[1] & 524544 ) != 0 )	nSel = ( nSel + 1 ) % 3;
			
			// if( ( Key[1] & 1048608 ) != 0 ){
      if (OnKey == -10) {

				// HowTo...
				GF[14] = false;

				if( nSel == 2 )	GM = 1000;
				else
				{					
					if(I[10] == null && nSel == 0) {  // load only Faces
            GM = -1;
            progmax = 8 * 5;
            progress = 0;
						LoadGraph(10, 17, 5);
            try { Thread.sleep(500); } catch(Exception e) {}
					}

          Key[3] = 0;
					GM = 100;
          
					GF[13] = false;

					// How To..
					if( nSel == 1 ){
						VSList[0] = 0;
						LineY = 0;
						nScroll = 0;
						LineX = 0;
						Frame = 0;
						JX = 59;
						PXY = 0;

						GF[14] = true; // Tutorial ...

            if (I[18] == null) {
              progmax = 19*3 + 11;
              progress = 0;
              GM = -1;
              LoadGraph(18, 36, 3);
            }

            if (I[45] == null) LoadTeamGraph();
            else ChangeTeamGraph();

						GM = 350;
						CreateWind();
					}
					HowTo = 0;
				}
				nSel = 0;
				Frame = 0;
				return;
			}
		}
		//--------------------------------------------------------------------------		
		if (GM == 100){			

			if (Frame < 4) Frame++;

			if( !GF[13] ) {	

				if( ( Key[1] & 131076 ) != 0 ){
					nSel -= 4;
					Frame = 0;
					GF[1] = true;
				}
				
				if( ( Key[1] & 524544 ) != 0 ){

					if( fClear != 0 ){
						if( nSel != 7 && !GF[13] ){
							nSel += 4;
						} else GF[13] = true;
					}
					else nSel += 4;

					Frame = 0;
					GF[1] = true;
				}
				
				if( ( Key[1] & 65682 ) != 0 ){
					nSel--;
					Frame = 0;
					GF[1] = true;
				}

				if( ( Key[1] & 262728 ) != 0 ){
					nSel++;
					Frame = 0;
					GF[1] = true;
				}
			}
			else if( ( Key[1] & ( 131076 | 524544 | 65682 | 262728 ) ) != 0 )
				GF[13] = false;

			nSel %= 8;
			if (nSel < 0)  nSel += 8;
			if (nSel == 7) VSList[ 0 ] = Math.abs( R.nextInt() % 7 );
			else VSList[0] = nSel;

			if(GF[13]) VSList[0] = 7;

			GF[1] = true;

      if( ( Key[1] & 1048608 ) != 0 ){   // action key (OK)
				Draw();
        totalScore = 0;
				nStage = 1;
        if (I[18] == null) {
          progmax = 19*3 + 10;
          progress = 0;
          GM = -1;
          LoadGraph(18, 36, 3);				
        }

        if (I[45] == null) LoadTeamGraph();
        else ChangeTeamGraph();

				GF[11] = true;
				Frame = 0;
				GM = 200;
				nSel = 0;
				Kaisuu = 1;
				return;
			}
		}

		//--------------------------------------------------------------------------
		if(GM == 200){
			
			if( GF[11] ){

				//System.gc();				

				for(i = 1; i < 4;) {
					j = Math.abs( R.nextInt() % 7 );
					if (i == 1 && nStage == 5) j = 7;
          for( x = 0; x < i; x++)
            if( j == VSList[ x ] && j != 7 ) break;

					if( x == i ){
						VSList[ i ] = j;
						i++;
					}
				}
				GF[11] = false;
			}

			Frame++;
			if(nSel < 5 && CupTime[nSel] < Frame) {
				nSel++;
				//if(nSel == 5) setSoftLabel(SOFT_KEY_1, "delete?");
			}

			GF[1] = true;

			if( ( Key[1] & ( 1048608 | 2097152 ) ) != 0 && nSel == 5 ){
				GM = 300;
        
        nScore[0] = 0;
        // changed difficulty progression (harder first stages, same last stage) (15 +)
				nScore[1] = 15 + CpuScore[  (nStage-1)*6] + Math.abs(R.nextInt() % CpuScore[30+(nStage-1)*6]);
				nScore[2] = 15 + CpuScore[1+(nStage-1)*6] + Math.abs(R.nextInt() % CpuScore[31+(nStage-1)*6]);
				nScore[3] = 15 + CpuScore[2+(nStage-1)*6] + Math.abs(R.nextInt() % CpuScore[32+(nStage-1)*6]);

				GF[11] = true;
				Frame = 0;
				return;
			}
		}
		
		//--------------------------------------------------------------------------
		if( GM == 300 ){

      // GF[15] = GF[14];

			if (GF[11]) {
				LineY = 0;
				nScroll = 0;
				LineX = 0;
				Frame = 0;
				JX = 59;
				PXY = 0;
				GF[11] = false;
			}

      // GF[2] = true;
			if (Frame > 24) {				
				GM = 350;
				CreateWind();
				WindTime = 0;
				Frame = 0;
				GF[1] = true;
			}
      else Frame++;
		}

		//--------------------------------------------------------------------------
		if (GM == 350) {

			GF[2] = true;
			GF[15] = false;

			// Tutorial 3
			if (GF[14] && Frame > 54 ) {
				Key[1] = 1048608;				
				Wind = 0;
				WindPow = 1;
				WindUD = 255;
				WindLRPow = 0;
				GF[15] = false;
			}
			
			if( ( Key[1] & ( 1048608 | 2097152 ) ) != 0 ){
				GM = 400;
				WindTime = 10 + Math.abs( R.nextInt() % 11 );				
				Frame = 0;
				WindLR = 0;
				OffJP = 0;
				Pow = 0;
				GF[1] = true;
				GF[11] = false;
				return;
			}

			WindTime = ( WindTime + 1 ) % 5;
			if( WindTime == 0 ){
				CreateWind();
				WindTime = 0;
			}
			Frame++;

			// Tutorial 1
			if( GF[14] && ( Frame > 24 && Frame < 40 ) ){
				GF[15] = true;
			}

			// Tutorial 2
			if( GF[14] && Frame > 39 ){
				HowTo = 1;
				GF[15] = true;
			}

		}

		//--------------------------------------------------------------------------
		if( GM == 400 ){

      // GF[1] = true;
			Frame++;

			if( Frame < 31)	CVY = ( 10 * Frame ) / 30;
			LineOY = LineY;
			LineY -= CVY;
			
			if( LineY < 0 ) LineY += 32;

			nScroll += CVY;

			if( nScroll > 297 ) {
				JX -= 10;
				GF[1] = true;
			}

			if( nScroll > 317 && !GF[11] ){
				Pow = ( Pow + 5 ) % 55;
				if( ( Key[1] & 1048608 ) != 0 ) GF[11] = true;
			}

			if( Frame == 51 ){
				PXY = 0;
				Draw();
				GM = 500;
				Frame = 0;
				CVY = 1;
				JX = -2;

				// Tutorial Timer
				Temp[0] = 0;
				// Tutorial Frag
				GF[16] = GF[14];
				HowTo = 2;
				return;
			}
		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -