protected void pauseApp() throws MIDletStateChangeException
protected void destroyApp(boolean unconditional) throws MIDletStateChangeException
Game Description: Chota Bheem has to navigate through a forest, collecting items and avoiding obstacles to reach his final destination. Simple Game Structure This example won't cover the entire game but will give you an idea of how to start. Game Class import javax.microedition.khronos.opengles.GL10; import javax.microedition.lcdgc.Graphics; import javax.microedition.lcdgc.Image; import java.util.Random; action games chota bheem 240x320.jar
public void commandAction(Command c, Displayable d) if (c == exitCommand) notifyDestroyed();
protected void startApp() throws MIDletStateChangeException public void commandAction(Command c
private Canvas getGameCanvas() Canvas canvas = new Canvas() protected void paint(Graphics g) g.setColor(0x00, 0x00, 0x00); g.fillRect(0, 0, getWidth(), getHeight()); g.drawImage(chotaBheemImage, chotaBheemX, chotaBheemY, Graphics.LEFT ; canvas.setCommandListener(this); canvas.addCommand(exitCommand); return canvas;
public class Game extends MIDlet implements CommandListener private Display display; private Command exitCommand; private Image chotaBheemImage; private int chotaBheemX = 100; private int chotaBheemY = 100; private int score = 0; private Command exitCommand
public Game() display = Display.getDisplay(this); exitCommand = new Command("Exit", Command.EXIT, 1); try chotaBheemImage = Image.createImage("/chotaBheem.png"); catch (IOException e) System.out.println(e.getMessage()); display.setCurrent(getGameCanvas());