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

📄 aims.java

📁 超经典飞机射击游戏
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                    //if going form menu we have to load GFX
                    case 199:
                        //JUST A TRICK MAYBE TEMP
                        if(gamemode==10){//if going from MENU
                            gamemode=198;
                            repaint();
                            serviceRepaints();
                            tempGFXUpdateRoutine(level/3+1);
                            //lets perform some pre painting for compilation and warm up :)
                            //because of some problems
                            //#if _65_
//#                             gamemode=200;
//#                             //MoveObjects();
//#                             for(int i=0;i<20;i++){
//#                                 //System.out.println("bla");
//#                                 //Scroll(1,SCROLLSPEED);
//#                                 MoveObjects();
//#                                 repaint();
//#                                 serviceRepaints();
//#                             }
                            //#endif
                        }else if(gamemode==204){//if switching level
                            gamemode=198;
                            repaint();
                            serviceRepaints();
                            LoadLevel("map"+level+".NOK");
                            if(level%3==0)tempGFXUpdateRoutine(level/3+1);
                        }
                        //we have to stop endboos music and play stage music if needed
                        //#if _MMAPI_
//#                         else if(gamemode==202){
//#                             /*try{
//#                                 endboss_music.deallocate();
//#                                     //stage_music.setLoopCount(-1);
//#                                 title_music.deallocate();
//#                                 stage_music.prefetch();
//#                                 if(musicopt)stage_music.start();
//#                             }catch(Exception e){
                                //#if _DEBUG_
//#                                 e.printStackTrace();
                                //#endif
//#                             }*/
//#                             playSound(stage_music,true);
//#                         }
                        //#endif
                        InitLevel();
                        break;
                    //IF desired mode is EXIT
                    case 9999:
                        midlet.destroyApp(false);
                        return;
                    //if going to menu play sound 2 times or MMAPI loop    
                    case 10:
                        //#if _NOKIA_ && !_MMAPI_
                        if(musicopt && gamemode!=400 && gamemode!=500 && gamemode!=800)playSound(tile_music_s,2);
                        //#elif _MMAPI_
//#                         /*try{
//#                             //first try to stop everything
//#                             endboss_music.deallocate();
//#                             stage_music.deallocate();
//#                             //the loop the title music
//#                             //title_music.setLoopCount(-1);
//#                             title_music.prefetch();
//#                             if(musicopt)title_music.start();
//#                         }catch(Exception e){
                            //#if _DEBUG_
//#                             e.printStackTrace();
                            //#endif
//#                         }*/
//#                         playSound(title_music,true);
                        //#endif
                        //if WE GOING TO HENTRY we have to prepare some vars
                        break;
                    case 399:
                        //temp1 will be a letter indicator
                        temp1=0;
                        //we have to set safe menumode
                        menumode=0;
                        break;
                    //we have to prepare some values before switching to scrolable part
                    case 500:
                    case 800:
                        //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;
                    //this section is only for MMAPI;
                    //we have to stop the title music and go back to stage music
                    //#if _MMAPI_
//#                     //this means we going from pause directly without level load
//#                     case 200:
//#                         playSound(stage_music,true);
//#                         break;
                    //#elif _NOKIA_
                    case 200:
                        try{
                            tile_music_s.stop();
                        }catch(Exception e){}
                        break;
                    //#endif
                }
                gamemode=desired_mode;
                //we have to set a wipe out effect becouse it always come after wipe in
                clipping_var=-clipping_var;
            }
        }else{//wipe out
            clipping+=clipping_var;
            if(clipping<=0){
                gamemode=desired_mode;
                //we have to deactivate swiping mode
                clipping_var=0;
            }
        }
        
        //anihilate any events during swiping
        game_keypressed=0;
    }else switch (gamemode){
        //LANGUAGE CHOOSING
        case 0:
            
            //temp1 is a lang pointer
            switch(game_keypressed){
                case FIRE:
                    loadLanguage(temp1);
                    //records are open so we have to write a lang once and never more
                    //if we are here that means this is the first time midlet is running
                    try{
                        ByteArrayOutputStream bais = new ByteArrayOutputStream();
                        DataOutputStream out = new DataOutputStream(bais);
                        out.writeByte(temp1);
                        out.close();
                        byte[] bytes=bais.toByteArray();
                        records.addRecord(bytes,0,bytes.length);
                        
                        //we have to prepare a good numeration of records
                        //prepare record id for highscores as 2
                        records.addRecord(null,0,0);
                        //prepare id for continue routine as 3
                        records.addRecord(null,0,0);
                    }catch(Exception e){
                        //#if _DEBUG_
//#                         e.printStackTrace();
                        //#endif
                    }
                    //switch to intro mode
                    gamemode=1;
                    //set the intro bkg color to white
                    temp1=255;
                    langs=null;
                    break;
                case UP:
                    if(--temp1<0)temp1=langs.length-1;
                    break;
                case DOWN:
                    if(++temp1>=langs.length)temp1=0;
                    break;
            }
            game_keypressed=0;
            keypressed=0;
            break;
        case 1://INTRO
            //#if _CHEAT_
//#             if(keypressed!=0){
//#                 temp2=3;
//#                 temp3=10;
//#                 keypressed=0;
//#             }
            //#endif
            //temp1 is color temp2 is intro mode temp3 is counter
            switch(temp2){
                //fade the screen to black
                case 0:
                    TilebufferP.setColor(temp1,temp1,temp1);
                    TilebufferP.fillRect(0,0,screenX,screenY);
                    temp1-=25;
                    temp3++;
                    if(temp3==11){
                        temp3=0;
                        temp1=0;
                        temp2=1;
                    }
                    break;
                //paint rectangle fading to white behind the logo
                case 1:
                    TilebufferP.setColor(temp1,temp1,temp1);
                    TilebufferP.fillRect((screenX-bobgfx[0].getWidth())/2,(screenY-bobgfx[0].getHeight())/2,bobgfx[0].getWidth(),bobgfx[0].getHeight());
                    TilebufferP.drawImage(bobgfx[0],(screenX-bobgfx[0].getWidth())/2,(screenY-bobgfx[0].getHeight())/2,Graphics.TOP|Graphics.LEFT);
                    temp3++;
                    temp1+=25;
                    if(temp3==11){
                        temp3=0;
                        temp1=255;
                        temp2=2;
                    }
                    break;
                //wait one second
                case 2:
                    if(++temp3==11){
                        temp2=3;
                        temp3=0;
                    }
                    break;
                //fade out RECT to full black
                case 3:
                    TilebufferP.setColor(temp1,temp1,temp1);
                    TilebufferP.fillRect((screenX-bobgfx[0].getWidth())/2,(screenY-bobgfx[0].getHeight())/2,bobgfx[0].getWidth(),bobgfx[0].getHeight());
                    TilebufferP.drawImage(bobgfx[0],(screenX-bobgfx[0].getWidth())/2,(screenY-bobgfx[0].getHeight())/2,Graphics.TOP|Graphics.LEFT);
                    temp3++;
                    temp1-=25;
                    if(temp3==11){
                        temp3=0;
                        temp1=255;
                        temp2=2;
                        //have to replace first image
                        try{
                            bobgfx[0]=null;
                            bobgfx[0] = Image.createImage("/kachel.png");
                        }catch(Exception e){
                            //#if _DEBUG_
//#                             e.printStackTrace();
                            //#endif
                        }
                        //#if _S40_ && !_MMAPI_
//#                         FPS=10;
                        //#endif
                        //switch to main menu
                        gamemode=10;
                        //play tile music
                        //#if _NOKIA_ && !_MMAPI_
                        if(musicopt)playSound(tile_music_s,2);
                        //#elif _MMAPI_
//#                         /*if(musicopt)try{
//#                             title_music.prefetch();
//#                             title_music.start();
//#                         }catch(Exception e){
                            //#if _DEBUG_
//#                             e.printStackTrace();
                            //#endif
//#                         }*/
//#                         playSound(title_music,true);
                        //#endif
                    }
            }
            break;
  	//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
  		
        case 10: // MENU
            switch (menumode){
                case 0://START MISSION
                    //DrawText(TilebufferP,"NEW GAME",screenX/2,100,1);
                    if(game_keypressed == FIRE){
                        //since we have this wipe in/out effect we have to set just a desired mode
                        desired_mode = 199;
                        //InitLevel();//level init
                        level=0;
                        lifes=3;
                        player_missiles=0;
                        player_sbombs=0;
                        player_power=1;
                        clipping_var=7;
                        score=0;
                        game_keypressed=0;
                        LoadLevel("map"+level+".NOK");
                    }
                    break;
                case 1://CONTINUE
                    if(game_keypressed==FIRE){
                        //if this restart comes from pause
                        if(leveldata!=null){
                            desired_mode=200;
                            clipping_var=7;
                            game_keypressed=0;
                        }else{//if this restart comes from saved game in RMS
                            //since we have this wipe in/out effect we have to set just a desired mode
                            desired_mode = 199;
                            //InitLevel();//level init
                            clipping_var=7;
                            game_keypressed=0;
                            LoadLevel("map"+level+".NOK");
                        }
                    }
                    //DrawText(TilebufferP,"CONTINUE",screenX/2,100,1);
                    //TilebufferP.setColor(0x000000);
                    break;
                case 2://SOUND
                    //DrawText(TilebufferP,"SOUND "+changeopt,screenX/2,100,1);
                    if(game_keypressed == FIRE){
                        /*if(soundopt == 0){
                            soundopt = 1;
                        }else{
                            soundopt = 0;
                        }*/
                        soundopt=!soundopt;
                        game_keypressed=0;
                    }
                    break;
                case 3://MUSIC
                    if(game_keypressed == FIRE){
                        /*if(musicopt == 0){
                            musicopt = 1;
                        }else{
                            musicopt = 0;
                        }*/
                        musicopt=!musicopt;
                        //#if _NOKIA_ && !_MMAPI_
                        if(!musicopt)tile_music_s.stop();
                        else playSound(tile_music_s,2);
                        //#elif _MMAPI_
//#                         /*try{
//#                             if(!musicopt)title_music.stop();
//#                             else title_music.start();
//#                         }catch(Exception e){
                            //#if _DEBUG_
//#                             e.printStackTrace();
                            //#endif
//#                         }*/
//#                         if(!musicopt){
//#                             //playSound(null,false);
//#                             try{
//#                                 title_music.stop();
//#                                 title_music.deallocate();
//#                             }catch(Exception e){}
//#                         }else playSound(title_music,true);
                        //#endif

⌨️ 快捷键说明

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