各位大侠能不能帮帮小弟 检查一下
这段代码写好后始终无法实现计时过程,也没有游戏结束显示,知道的能不能告知一下 万分感激
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import java.util.*;
import java.io.*;
import javax.microedition.media.*;
import javax.microedition.media.control.*;
public class UFOCanvas extends GameCanvas implements Runnable {
private Display display;
private boolean sleeping;
private long frameDelay;
private long gametime;
private long gametimeoffset;
private Random rand;
private Image background;
private Sprite ufoSprite;
private Sprite holeredSprite;
private Sprite holeblueSprite;
private int holeoneX;
private int holetwoX;
private int holeoneY;
private int holetwoY;
private int a;
private int ufoXSpeed, ufoYSpeed;
private Sprite[] roidSprite = new Sprite[7];
private boolean gameOver;
private int numLives;
private Player musicPlayer;
private Player gameoverPlayer;
public UFOCanvas(Display d) {
super(true);
display = d;
frameDelay = 33;
refresh();}
private void refresh(){
rand = new Random();
holeoneY = rand.nextInt(240);
holeoneX = rand.nextInt(200);
holetwoY = rand.nextInt(200);
holetwoX = rand.nextInt(240);
}
public void start() {
display.setCurrent(this);
gametime=0;
gametimeoffset=System.currentTimeMillis();
gameOver = false;
numLives = 2;
try {
background=Image.createImage("/Universe.png");
holeredSprite = new Sprite(Image.createImage("/holeone.png"));
holeredSprite.setPosition(holeoneX,holeoneY);
holeblueSprite = new Sprite(Image.createImage("/holetwo.png"));
holeblueSprite.setPosition(holetwoX,holetwoY);
ufoSprite = new Sprite(Image.createImage("/Saucer.png"));
ufoSprite.setPosition((getWidth() - ufoSprite.getWidth()) / 2, (getHeight() - ufoSprite.getHeight()) / 2);