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

📄 aims.java

📁 超经典飞机射击游戏
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                            break;
                        }
                    }
                    break;
                case UP:
                    //temp2=namebuf.charAt(temp1);
                    //we chave to chceck if A->Z
                    //if(temp2==32)temp2=90;
                    //else if(--temp2<65)temp2=32;
                    //temp2 is global for this mode and is a pointer to current letter in alphabet
                    if(--temp2<0)temp2=ALPHABET.length()-1;
                    //namebuf.setCharAt(temp1,(char)temp2);
                    namebuf.setCharAt(temp1,ALPHABET.charAt(temp2));
                    break;
                case DOWN:
                    //temp2=namebuf.charAt(temp1);
                    //we chave to chceck if Z->A
                    //if(temp2==32)temp2=65;
                    //else if(++temp2>90)temp2=32;
                    if(++temp2>=ALPHABET.length())temp2=0;
                    //namebuf.setCharAt(temp1,(char)temp2);
                    namebuf.setCharAt(temp1,ALPHABET.charAt(temp2));
                    break;
            }
            break;
        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        //HIGHSCORE
        case 400:
            if(game_keypressed==FIRE){
                desired_mode=10;
                clipping_var=7;
                game_keypressed=0;
            }
            break;
        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        case 500://HELP
        case 800://CREDITS
            switch(game_keypressed){
                case FIRE:
                    desired_mode=10;
                    game_keypressed=0;
                    //set clipping var to positive value what means that we have to make wipe out
                    clipping_var=7;
                    
                    break;
                case DOWN:
                    //scroll the view since temp1 is y position in help mode
                    if(temp2+font.getHeight()>screenY)temp1-=font.getHeight();
                    break;
                case UP:
                    if(temp1<25)temp1+=font.getHeight();
                    break;
            }
            break;
        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
        //ENDGAME:
        case 1000:
            if(keypressed!=0){
                
                //going to highscore entry
                desired_mode=399;
                lifes=-1;
                clipping_var=7;
            }
            break;
        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
			
    }
		
    repaint();
    serviceRepaints();
}
/*#####################################################################	*/

// PAINT MEHODE 

/*#####################################################################	*/
    public void paint(Graphics g) {
        //if this is old S60 we have to force clipping
        //#if _S60_
        g.setClip(0,0,screenX,screenY);
        //#endif
        //#if _NOKIA_
        DirectGraphics dg=DirectUtils.getDirectGraphics(g);
        //#endif
        
        //apdate rotor variable here because of some problems
        
        ai+=45;
        ai%=360;
        
	//just set clip to efficiency but not everywhere works
        //#if !_65_
        if(clipping_var!=0){
            g.setClip(0,clipping,screenX,screenY-clipping*2);
        }
        //#endif
		// gamemode is the switcher for all different game modes
        String str=null;
        switch (gamemode){
            //TRICK just temp paint loading string
            case 198:
                //clear the screen
                g.setClip(0,0,screenX,screenY);
                g.setColor(0x000000);
                g.fillRect(0,0,screenX,screenY);
                g.setColor(0xffffff);
                g.setFont(font);
                g.drawString(LOADING_STR,screenX/2,screenY-20,g.TOP|g.HCENTER);
                g.setClip(0,clipping,screenX,screenY-clipping*2);
                break;
            //HELI GOES IN TO THE PLAYFIELD
            case 199:
                // copy tilebuffer to the screen	
                g.drawImage(Tilebuffer,softscrollx,softscrolly,Graphics.TOP|Graphics.LEFT);
                // draw alles sprites on the screen
                //#if _NOKIA_
                DrawSprites(dg,g);
                //#else
//#                 DrawSprites(g);
                //#endif
                paintRotor(g);
                //only if nto wipe in/out because of clipping in drawNumber
                if(clipping_var!=0)break;
                paintOtherStuff(g);
                g.setFont(font);
                paintOutlinedString(g,LEV_STR+(level+1),screenX/2,screenY/2-2,Graphics.BOTTOM|Graphics.HCENTER);
                paintOutlinedString(g,GETREADY_STR,screenX/2,screenY/2+3,Graphics.TOP|Graphics.HCENTER);
                
				break;
            //case 190:
            //NORMAL GAME MODE
            case 200:
            //FINAL BOSS MODE
            case 203:
                // copy tilebuffer to the screen	
                g.drawImage(Tilebuffer,softscrollx,softscrolly,Graphics.TOP|Graphics.LEFT);
                // draw all sprites on the screen
                //#if _NOKIA_
                DrawSprites(dg,g);
                //#else
//#                 DrawSprites(g);
                //#endif
                paintRotor(g);
                if(l_zone){
                    if(temp5>3){
                        g.setFont(font);
                        paintOutlinedString(g,LANDNOW_STR,screenX/2,screenY/4,Graphics.TOP|Graphics.HCENTER);
                    }else{//paint some rects to show the landing zone
                        temp1=-(levelxpos*tiledimension)+softscrollx;
                        temp2=-(levelypos*tiledimension)+softscrolly;
                        g.setColor(0xffffff);
                        g.fillRect(l_zonex/1000+temp1,l_zoney/1000+temp2,3,3);
                        g.fillRect(l_zonex/1000+temp1+20,l_zoney/1000+temp2,3,3);
                        g.fillRect(l_zonex/1000+temp1+20,l_zoney/1000+temp2+20,3,3);
                        g.fillRect(l_zonex/1000+temp1,l_zoney/1000+temp2+20,3,3);
                        //g.drawRect((l_zonex/1000)-(levelxpos*tiledimension)+softscrollx,(l_zoney/1000)-(levelypos*tiledimension)+softscrolly,16,16);
                    }
                }
                //only if nto wipe in/out because of clipping in drawNumber
                if(clipping_var==0)paintOtherStuff(g);
				break;
            //LANDING ZONE GAMEMODE
            case 201:
                // copy tilebuffer to the screen	
                g.drawImage(Tilebuffer,softscrollx,softscrolly,Graphics.TOP|Graphics.LEFT);
                // draw alles sprites on the screen
                //#if _NOKIA_
                DrawSprites(dg,g);
                //#else
//#                 DrawSprites(g);
                //#endif
                paintRotor(g);
				
				//only if nto wipe in/out because of clipping in drawNumber
                if(clipping_var==0)paintOtherStuff(g);
                
                g.setFont(font);
                temp1=font.getHeight();
                paintOutlinedString(g,RESTROOPS_STR,screenX/2,screenY/2-(2*temp1),Graphics.TOP|Graphics.HCENTER);
                paintOutlinedString(g,YOUHAVERES_STR,screenX/2,screenY/2-temp1,Graphics.TOP|Graphics.HCENTER);
                paintOutlinedString(g,temp5+TROOPS_STR,screenX/2,screenY/2,Graphics.TOP|Graphics.HCENTER);
                paintOutlinedString(g,PRESSFIRE_STR,screenX/2,screenY-2*temp1,Graphics.TOP|Graphics.HCENTER);
                break;
            //PLAYER DYING MODE
            case 202:
                // copy tilebuffer to the screen	
                g.drawImage(Tilebuffer,softscrollx,softscrolly,Graphics.TOP|Graphics.LEFT);
                // draw alles sprites on the screen
                //#if _NOKIA_
                DrawSprites(dg,g);
                //#else
//#                 DrawSprites(g);
                //#endif
                //only if nto wipe in/out because of clipping in drawNumber
                if(clipping_var!=0)break;
                paintOtherStuff(g);
                //String str=null;
                g.setFont(font);
                temp1=font.getHeight()+2;
                if(lifes>=0){
                    paintOutlinedString(g,LIFELOST_STR,screenX/2,screenY/2-temp1,Graphics.TOP|Graphics.HCENTER);
                    paintOutlinedString(g,PRESSFIRE_STR,screenX/2,screenY-temp1-temp1/2,Graphics.TOP|Graphics.HCENTER);
                }else{
                    paintOutlinedString(g,GAMEOVER_STR,screenX/2,screenY/2-temp1*3,Graphics.TOP|Graphics.HCENTER);
                    paintOutlinedString(g,MISSIONFAILED_STR,screenX/2,screenY/2-temp1*2,Graphics.TOP|Graphics.HCENTER);
                    paintOutlinedString(g,SCORE_STR+score,screenX/2,screenY/2-temp1,Graphics.TOP|Graphics.HCENTER);
                    paintOutlinedString(g,LEV_STR+(level+1),screenX/2,screenY/2,Graphics.TOP|Graphics.HCENTER);
                    paintOutlinedString(g,PRESSFIRE_STR,screenX/2,screenY-temp1-temp1/2,Graphics.TOP|Graphics.HCENTER);
                }

                
                
                break;
            case 204:
                // copy tilebuffer to the screen	
                g.drawImage(Tilebuffer,softscrollx,softscrolly,Graphics.TOP|Graphics.LEFT);
                // draw alles sprites on the screen
                //#if _NOKIA_
                DrawSprites(dg,g);
                //#else
//#                 DrawSprites(g);
                //#endif
                paintRotor(g);
                if(clipping_var==0){//paint only if no wipe in becouse of efficiency
                    g.setFont(font);
                    temp1=font.getHeight()+2;
                    paintOutlinedString(g,CONGRATULATIONS_STR,screenX/2,screenY/2-temp1*2,Graphics.TOP|Graphics.HCENTER);
                    paintOutlinedString(g,LEVCLEARED_STR,screenX/2,screenY/2-temp1,Graphics.TOP|Graphics.HCENTER);
                    paintOutlinedString(g,YOURSCORE_STR,screenX/2,screenY/2,Graphics.TOP|Graphics.HCENTER);
                    paintOutlinedString(g,""+score,screenX/2,screenY/2+temp1,Graphics.TOP|Graphics.HCENTER);
                    paintOutlinedString(g,PRESSFIRE_STR,screenX/2,screenY-20,Graphics.TOP|Graphics.HCENTER);
                }
                break;
            //MENU MODE
            case 10:
                // background camouflage in the main menu
                //#if _S40_ && !_MMAPI_
//#                 for(int i=0;i<screenX;i+=32)
//#                     for(int j=0;j<screenY;j+=32){
//#                         g.drawImage(bobgfx[0],i,j,Graphics.TOP|Graphics.LEFT);
//#                     }
//# 				
//#                 //g.setColor(0x6B8E63);
//#                 //g.fillRect(0,20,screenX,45);
//# 
//#                 g.drawImage(bobgfx[1],(screenX/2)-3,27,Graphics.TOP|Graphics.HCENTER); 	// GAMELOGO	
//#                 g.drawImage(bobgfx[15],screenX/2,screenY-1,Graphics.BOTTOM|Graphics.HCENTER); 		// COPYRIGHT	
                //#else
                g.drawImage(bobgfx[1],0,0,Graphics.TOP|Graphics.LEFT);
                //#endif
                
                if(clipping_var!=0)break;
                g.setFont(font);
                //draw "pause" text if it was pause indicates by lifes>=0
                if(lifes>=0){
                    g.setColor(0xffffff);
                    g.drawString(PAUSE_STR,screenX/2,PAUSE_Y,Graphics.TOP|Graphics.HCENTER);
                }
                switch(menumode){
                    case 0://START MISSION
                        if(lifes>=0) str=RESTARTMISSION_STR;
                        else str=MSTARTMISSION_STR;
                        break;
                    case 1://CONTINUE
                        str=MCONTINUE_STR;
                        break;
                    case 2://SOUND
                        str=MSOUND_STR;
                        // CHANGE SOUND OPTIONS YES/NO
                        if(!soundopt)str+= OFF_STR;
                        else str+= ON_STR;
                        break;
                    case 3://MUSIC
                        str=MMUSIC_STR;
                        // CHANGE MUSIC OPTIONS YES/NO
                        if(!musicopt) str+= OFF_STR;
                        else str+= ON_STR;
                        break;
                    case 4://VIEW HIGHSCORE
                        str=MVIEWHIGHSCORE_STR;
                        break;
                    case 5://VIEW HELP
                        str=MVIEWHELP_STR;
                        break;
                    case 6://ABOUT
                        str=MABOUT_STR;
                        break;
                    case 7://SAVE & QUIT
                        str=MSAVEQUIT_STR;
                        break;
                }
                //draw specified text with outline
                paintOutlinedString(g,str,screenX/2,MENU_Y,Graphics.TOP|Graphics.HCENTER);
                //draw arrows 
                //left arrow
                g.drawImage(bobgfx[53],8+waiter,MENU_Y+font.getBaselinePosition()/2,Graphics.VCENTER|Graphics.HCENTER);
                g.drawImage(bobgfx[52],screenX-8+waiter*-1,MENU_Y+font.getBaselinePosition()/2,Graphics.VCENTER|Graphics.HCENTER);
                break;
            //LANGUAGE CHOOSING
            case 0:
                g.setFont(font);
                for(int i=0,fh=font.getHeight(),ybeg=(screenY-fh*langs.length)/2;i<langs.length;i++){
                    if(temp1==i) g.setColor(0xff0000);
                    else g.setColor(0x000000);
                    g.drawString(langs[i],screenX/2,ybeg+i*fh,Graphics.TOP|Graphics.HCENTER);
                }
                break;
            //INTRO MODE
            case 1:
                // copy tilebuffer to the screen because intro is painted on it
                g.drawImage(Tilebuffer,softscrollx,softscrolly,Graphics.TOP|Graphics.LEFT);
                break;
            //HIGHSCORE ENTRY
            case 399:
                //temp4 will be a y axis
                temp4=25;
                for(int i=0;i<screenX;i+=32)
                    for(int j=0;j<screenY;j+=32){
                        g.drawImage(bobgfx[0],i,j,Graphics.TOP|Graphics.LEFT);
                    }
                

⌨️ 快捷键说明

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