一块J2ME的手机游戏,就是经典的<手机泡泡龙游戏>

源代码在线查看: paopao.java

软件大小: 84 K
上传用户: mislrb
关键词: J2ME lt gt 手机游戏
下载地址: 免注册下载 普通下载 VIP

相关代码

				package paopao;
				
				import javax.microedition.midlet.*;
				import javax.microedition.lcdui.*;
				
				public class PaoPao extends MIDlet {
				  private static PaoPao instance;
				  private static Logo logo;
				  private static Menu menu;
				  private static GameWorld gw;
				  static boolean isNewGame      = true;
				  static final int LOGO_ID      = 1;
				  static final int MENU_ID      = 2;
				  static final int GAMEWORLD_ID = 3;
				  /** Constructor */
				  public PaoPao() {
				    instance = this;
				
				  }
				  private static void loadResource()
				  {
				  Resource.init(40);
				  for(int i = 1; i 				  Resource.setImage(i,Resource.DIR + "point" + i * 6  + ".png");
				  Resource.setImage(Resource.BG,Resource.DIR + "bg.png");
				  Resource.setImage(Resource.BALL,Resource.DIR + "ball.png");
				 // Resource.setImage(Resource.BALL_BOMB,Resource.DIR + "ball_bomb.png");
				 // Resource.setImage(Resource.POINT,Resource.DIR + "point.png");
				 // Resource.setImage(Resource.AID_LINE,Resource.DIR + "aid_line.png");
				  //Resource.setImage(Resource.PROPS,Resource.DIR + "props.png");
				  //Resource.setImage(Resource.BBALL,Resource.DIR + "bball.png");
				  }
				  /** Main method */
				  public void startApp() {
				if(isNewGame)
				    {
				    Resource.loadAngleValue();
				    loadResource();
				    isNewGame = false;
				    shiftCanvas(GAMEWORLD_ID,6);
				    }
				  }
				
				  /** Handle pausing the MIDlet */
				  public void pauseApp() {
				  }
				
				  /** Handle destroying the MIDlet */
				  public void destroyApp(boolean unconditional) {
				    gw = null;
				        isNewGame = true;
				        instance.notifyDestroyed();
				        instance = null;
				        System.gc();
				
				  }
				
				  /** Quit the MIDlet */
				  public static void quitApp() {
				    instance.destroyApp(true);
				  }
				
				 protected static void shiftCanvas(int canvasId,int hardLevel)
				 {
				 switch(canvasId)
				  {
				  case LOGO_ID:
				logo = new Logo();
				Display.getDisplay(instance).setCurrent(logo);
				    break;
				  case MENU_ID:
				menu = new Menu();
				Display.getDisplay(instance).setCurrent(menu);
				    break;
				  case GAMEWORLD_ID:
				if(gw == null)
				gw = new GameWorld(hardLevel);
				gw.show();
				Display.getDisplay(instance).setCurrent(gw);
				    break;
				    default :
				      break;
				  }
				 }
				
				}
							

相关资源