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

📄 flight.java

📁 Source-DeathFlight手机游戏,死亡飞行,适合初学者学习.
💻 JAVA
字号:
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.*;
import java.io.*;

public class Flight extends MIDlet {
	
	protected Display display = null;
	
	protected Score score;
	
	protected int scorevalue;
	
	private MainMenu mainmenu = null;
	
	private HighScoreScreen highscorescreen = null;
	
	private OptionScreen optionscreen = null;
	
	private GameLoop Game = null;
	
	public Flight() {
		super();
		
		
		display = Display.getDisplay(this);
		
		score = new Score("HallOfFame");
		
		mainmenu = new MainMenu(this);
		
		highscorescreen = new HighScoreScreen(this,score);
		
		optionscreen = new OptionScreen(this);
		
		
	}

	protected void startApp() throws MIDletStateChangeException {
		
		showMainMenu();
		
	}

	protected void pauseApp() {
	}

	protected void destroyApp(boolean arg0){
		System.gc();
		notifyDestroyed();
	}
	
	protected void Quit(){
		this.destroyApp(true);
	}
	
	protected void startGame(){
		Game = null;
		Game = new GameLoop(this);
		Game.start();
		display.setCurrent(Game);
	}
	
	protected void showHighScore(){
		try{
			highscorescreen.init();
		}catch(Exception e){
			e.printStackTrace();
		}
		this.display.setCurrent(highscorescreen);
	}

	protected void showMainMenu(){
		display.setCurrent(mainmenu);
	}
	
	protected void getScore(){
		try{
			scorevalue = Game.getScore();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	protected void addHighScore(int scorevalue){
		try{
			if(highscorescreen.isHighScore(scorevalue) == true){
				AddHighScoreScreen addhighscorescreen = new AddHighScoreScreen(this,scorevalue);
				this.display.setCurrent(addhighscorescreen);
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		showHighScore();
	}
	
	protected void showHelp(){
		
		Alert helpScreen =  new Alert(null,"按#健往上飞,否则飞机将自动下坠,碰撞到障碍物游戏即结束\n\nSilentVoid制作\blog.csdn.net/Silentvoid\nadamgic@163.com",null,AlertType.INFO);
		
		helpScreen.setTimeout(5000);
		
		display.setCurrent(helpScreen,mainmenu);
	}
	
	protected void showOption(){
		display.setCurrent(optionscreen);
	}
}

⌨️ 快捷键说明

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