serpentgame.java

来自「Position.java :辅助类 SerpentGameCanvas.jav」· Java 代码 · 共 48 行

JAVA
48
字号
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;

public class SerpentGame extends MIDlet
{
	private Display display;
	
	public SerpentGame()
	{
		display = Display.getDisplay(this);
	}
	
	public void startApp()
	{
		try {
			SerpentGameCanvas t = new SerpentGameCanvas(this);
			display.setCurrent(t);
		}
        catch(Exception ex)
        {
            ex.printStackTrace();
//			System.err.println(ex.getMessage());
        }
	}
	
	public void pauseApp()
	{
	}

	public void destroyApp(boolean unconditional)
	{
	}

	public void showGameOver(int score, int stage)
	{
		try {
			TextBox t = new TextBox("Game Over", "Congratulation!!\nYou got score\n   "+score+"\nYou arrive stage\n   "+stage, 256, 0);
			display.setCurrent(t);
		}
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
	}
		
}

⌨️ 快捷键说明

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