}
public void run() { while (running) { repaint(); updateGame(); try Thread.sleep(30); catch (Exception e) {} } }
public CatchGame() display = Display.getDisplay(this); exitCommand = new Command("Exit", Command.EXIT, 1); gameCanvas = new GameCanvas(); gameCanvas.addCommand(exitCommand); gameCanvas.setCommandListener(this);
// Catcher size: 60x20 private static final int CATCHER_W = 60; private static final int CATCHER_H = 20; private static final int BALL_SIZE = 8;
public void startApp() display.setCurrent(gameCanvas); gameCanvas.start();
public GameCanvas() width = 240; height = 320; catcherX = width/2 - CATCHER_W/2; catcherY = height - 40; ballX = width/2; ballY = 20; score = 0;