📄 gameover.java
字号:
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
public class gameOver
{
AcCV ac=null;
Image gameOverImg=null;
public gameOver(AcCV ac)
{
this.ac=ac;
try
{
gameOverImg=Image.createImage("/gameover.png");
}
catch(Exception e)
{
System.out.println("gameOver图片错误");
e.printStackTrace();
}
}
public void paint(Graphics g)
{
g.setClip(0, 0, ac.getWidth(), ac.getHeight());
g.setColor(0x000000);
g.fillRect(0, 0, ac.getWidth(), ac.getHeight());
g.drawImage(gameOverImg,(ac.getWidth()-gameOverImg.getWidth())/2, (ac.getHeight()-gameOverImg.getHeight())/2, 0);
if(ac.num>0&&ac.num<300){
Font font=Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_LARGE);
g.setFont(font);
g.setColor(250,0,0);
g.drawString("你好搓啊,", (ac.getWidth()-gameOverImg.getWidth())/2+50, (ac.getHeight()-gameOverImg.getHeight())/2+90, 0);
g.drawString("才打了这点分数!", (ac.getWidth()-gameOverImg.getWidth())/2+50, (ac.getHeight()-gameOverImg.getHeight())/2+105, 0);
g.drawString(""+ac.num, (ac.getWidth()-gameOverImg.getWidth())/2+65, (ac.getHeight()-gameOverImg.getHeight())/2+76, 0);
}
if(ac.num>300&&ac.num<900){
Font font=Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_LARGE);
g.setFont(font);
g.setColor(0,0,250);
g.drawString("没到一定分数,", (ac.getWidth()-gameOverImg.getWidth())/2+50, (ac.getHeight()-gameOverImg.getHeight())/2+90, 0);
g.drawString("第四关进不去可惜!", (ac.getWidth()-gameOverImg.getWidth())/2+50, (ac.getHeight()-gameOverImg.getHeight())/2+105, 0);
g.drawString(""+ac.num, (ac.getWidth()-gameOverImg.getWidth())/2+65, (ac.getHeight()-gameOverImg.getHeight())/2+76, 0);
}
if(ac.num>900){
Font font=Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_LARGE);
g.setFont(font);
g.setColor(0,250,0);
g.drawString("恭喜你全部,", (ac.getWidth()-gameOverImg.getWidth())/2+50, (ac.getHeight()-gameOverImg.getHeight())/2+90, 0);
g.drawString("过关可以的!", (ac.getWidth()-gameOverImg.getWidth())/2+50, (ac.getHeight()-gameOverImg.getHeight())/2+105, 0);
g.drawString(""+ac.num, (ac.getWidth()-gameOverImg.getWidth())/2+65, (ac.getHeight()-gameOverImg.getHeight())/2+76, 0);
}
}
public void recycleRes()
{
gameOverImg=null;
ac=null;
}
public void processEvent()
{
AcCV.state=1;
ac.eRun=true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -