📄 serpentgame.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -