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

📄 aims.java

📁 超经典飞机射击游戏
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                        game_keypressed=0;
                    }
                    break;
                case 4:// VIEW HIGHSCORE
                    if(game_keypressed==FIRE){
                        desired_mode=400;
                        clipping_var=7;
                        game_keypressed=0;
                    }
                    //DrawText(TilebufferP,"HIGHSCORES",screenX/2,100,1);
                    break;
                case 5:// VIEW HELP
                    if(game_keypressed == FIRE) {
                        desired_mode=500;
                        game_keypressed=0;
                        //set clipping var to positive value what means that we have to make wipe in
                        clipping_var=7;
                        //in HELP MODE temp1 will be a y position variable
                        //temp1=25;
                        //temp2 is end help string indicator. It is set in paint and tell us if the end of the string is visible
                        //temp2=screenY;
                    }
                    break;
                case 6://ABOUT
                    //since we have this wipe in/out effect we have to set just a desired mode
                    if(game_keypressed == FIRE) {
                        desired_mode=800;
                        game_keypressed=0;
                        //set clipping var to positive value what means that we have to make wipe in
                        clipping_var=7;
                        //in ABOUT MODE temp1 will be a y position variable
                        //temp1=25;
                        //temp2=screenY;
                    }
                    //DrawText(TilebufferP,"ABOUT",screenX/2,100,1);
                    break;
                case 7://QUIT AND SAVE
                    //DrawText(TilebufferP,"QUIT",screenX/2,100,1);
                    if(game_keypressed == FIRE) {
                        //gamemode = 800;
                        game_keypressed = 0;
                        //means exit
                        desired_mode=9999;
                        //set cliping var starts wipe in/out effect
                        clipping_var=7;
                    }
                    break;
            }
  			
            // ARROWS IN THE MENU
            if(waiter <= 8){
                if(waiter == 8)
                    waiter=0;
                else
                    waiter+=1;
            }	  		
  			
            //if(devicewaiter == 0){
            if(game_keypressed == RIGHT) {
                if(menumode == 7){
                    menumode = 0;
                }else{
                    menumode += 1;
                }
                //we chave to chceck if continue is possible otherwise skip this option
                if(menumode==1)
                    if(lifes<0)menumode++;
                //if this is MMAPI so sound is not needed
                //#if _MMAPI_
//#                 if(menumode==2)menumode++;
                //#endif
                game_keypressed=0;
            }

            if(game_keypressed == LEFT) {
                if(menumode == 0){
                    menumode = 7;
                }else{
                    menumode -= 1;
                }
                //if this is MMAPI sound is not needed
                //#if _MMAPI_
//#                 if(menumode==2)menumode--;
                //#endif
                //we chave to chceck if continue is possible otherwise skip this option
                if(menumode==1)
                    if(lifes<0)menumode--;
                
                game_keypressed=0;
            }
        //devicewaiter = 3;
        //}else{
        //	devicewaiter -= 1;
        //}
  			
            break;
  			
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
        //PLAYER ENTRY GAME MODE (player go into the playfield
        case 199:
            Scroll(1,scrollspeed);
            //move player into playefield
            if(ObjectDB[player][2]-(screenY/2+screenY/4)*1000>scrollypos)
                ObjectDB[player][2]-=5000;
            //otherwise switch to real game mode
            else gamemode=200;
            MoveObjects();
                movePlayerBullets();
                moveBullets();
        break;
    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
        case 200:
            if(keypressed==RSOFTKEY){
                desired_mode=10;
                clipping_var=7;
                menumode=1;
                game_keypressed=0;
                keypressed=0;
            }
            //#if _CHEAT_
//#             if(keypressed==48){
//#                 //pause=!pause;
//#                 //ObjectDB[player][9]=0;
//#                 //playerLoseLife();
//#                  //ObjectDB[player][9]=20;
//#                 gamemode=204;
//#                 
//#                 keypressed=0;
//#             }
//#             //ObjectDB[player][9]=20;
            //#endif
            //if(pause)return;
            //System.out.println(keypressed);
  			// PERMANENT SCROLLING 
            //if(scrollspeed>0)
            Scroll(1,scrollspeed); 
            //else Scroll(2,-scrollspeed);
            movePlayer();		
            MoveObjects();
            movePlayerBullets();
            moveBullets();
            //HANDLE LANDING ZONE
            if(!l_zone){
                if(scrollspeed<SCROLLSPEED)
                    scrollspeed+=LZONE_SLOWER;
                else scrollspeed=SCROLLSPEED;
            }else{
                //temp5 in this mode is a flashing "land now!" indicator
                if(++temp5>6)temp5=0;
                //slow down scrolling
                if(scrollspeed>0)
                    scrollspeed-=LZONE_SLOWER;
                else{
                    scrollspeed=0;
                    // if the scrollspeed is 0 that means the player lost the oportunity to land
                    l_zone=false;
                    //#if _DEBUG_
//#                     System.out.println("landing zone missed :(");
                    //#endif
                }
            }
            //pause=true;
            //DrawBackground(TilebufferP,TilebufferDG,0);
            break;
        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
        //LANDING ZONE GAMEMODE
        case 201:
            if(keypressed==RSOFTKEY){
                desired_mode=10;
                clipping_var=7;
                menumode=1;
                game_keypressed=0;
                keypressed=0;
            }
            if(game_keypressed==FIRE){
                gamemode=200;
                //clipping_var=7;
                keypressed=0;
                game_keypressed=0;
            }
            //RETRIVE PLAYER ENERGY
            ObjectDB[player][9]=20;

            MoveObjects();
            movePlayerBullets();
            moveBullets();
            break;
        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
        //PLAYER DYING GAME MODE
        case 202:
            Scroll(1,scrollspeed);
            if(game_keypressed==FIRE){
                if(lifes<0){
                    //if we have new highscore entry go to entry
                    //if hscore has lees then 10 elements
                    int t=6;
                    //#if _V220_
//#                     t=3;
                    //#endif
                    if(hpoints.size()<t && score>0){
                        desired_mode=399;
                        
                        //if last hscore entry is lower then actual points
                    }else if(((Integer)hpoints.elementAt(hpoints.size()-1)).intValue()<score && score>0){
                        desired_mode=399;
                        temp1=0;
                    //otherwise just guit to menu
                    }else desired_mode=10;
                    clipping_var=7;
                    //whatever it will be we have to set a safe default menuoption
                    menumode=0;
                    //softscrollx=0;
                    //softscrolly=0;
                    scrollspeed=SCROLLSPEED;
                }else{
                    //resets missiles,power,smartbombs
                    player_missiles=0;
                    player_sbombs=0;
                    player_power=1;
                    
                    scrollspeed=SCROLLSPEED;
                    desired_mode=199;
                    clipping_var=7;
                }
                keypressed=0;
                game_keypressed=0;
                break;
            }
            MoveObjects();
            movePlayerBullets();
            moveBullets();
            //slow down scrolling
            if(scrollspeed>0)
                scrollspeed-=7;
            break;
        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        //FINAL BOSS MODE
        case 203:
            if(keypressed==RSOFTKEY){
                desired_mode=10;
                clipping_var=7;
                menumode=1;
                game_keypressed=0;
                keypressed=0;
            }
            movePlayer();
            MoveObjects();
            movePlayerBullets();
            moveBullets();
            break;
        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        //END LEVEL MODE
        case 204:
            if(game_keypressed==FIRE){
                if(++level<9)
                    desired_mode=199;
                //end game
                else desired_mode=1000;
                clipping_var=7;
                game_keypressed=0;
            }else{
                game_keypressed=0;
                keypressed=0;
            }
            movePlayer();
            movePlayerBullets();
            moveBullets();
            break;
        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        //HIGHSCORE ENTRY
        case 399:
            
            switch(game_keypressed){
                //insert en entry
                case FIRE:
                    //we have to catch the name and calculate position in hscore
                    temp4=0;
                    if(hpoints.size()==0){
                        hnames.addElement(namebuf.toString());
                        hpoints.addElement(new Integer(score));
                    }else{ 
                        for(int i=0;i<hpoints.size();i++,temp4++){
                            if(((Integer)hpoints.elementAt(i)).intValue()<score){
                                break;
                            }
                        }
                        hnames.insertElementAt(namebuf.toString(),temp4);
                        hpoints.insertElementAt(new Integer(score),temp4);
                        //#if _V220_
//#                         if(hnames.size()==4){
//#                             hnames.removeElementAt(3);
//#                             hpoints.removeElementAt(3);
//#                         }
                        //#else
                        if(hnames.size()==7){
                            hnames.removeElementAt(6);
                            hpoints.removeElementAt(6);
                        }
                        //#endif
                    }
                    score=0;
                    desired_mode=400;
                    clipping_var=7;
                    game_keypressed=0;
                    break;
                case LEFT:
                    //temp1 is global for this mode and is pointer to index in namebuf
                    if(--temp1<0)temp1=namebuf.length()-1;
                    temp4=namebuf.charAt(temp1);
                    //calculate a correct index in alphabet
                    for(int i=0;i<ALPHABET.length();i++){
                        if(ALPHABET.charAt(i)==temp4){
                            temp2=i;
                            break;
                        }
                    }
                    break;
                case RIGHT:
                    //temp1 is global for this mode and is pointer to index in namebuf
                    if(++temp1>=namebuf.length())temp1=0;
                    temp4=namebuf.charAt(temp1);
                    //calculate a correct index in alphabet
                    for(int i=0;i<ALPHABET.length();i++){
                        if(ALPHABET.charAt(i)==temp4){
                            temp2=i;

⌨️ 快捷键说明

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