《JME手机游戏设计方案案例源代码GameEngineRecord》由会员分享,可在线阅读,更多相关《JME手机游戏设计方案案例源代码GameEngineRecord(36页珍藏版)》请在金锄头文库上搜索。
1、*GameMID。 Java/* To change this template, choose Tools | Templates* and open the template in the editor.*/import javax.microedition.lcdui.Display 。import javax.microedition.midlet.* 。/* author Administrator*/public class GameMID extends MIDlet private Display display 。private GameWorld gw=null 。publ
2、ic GameMID()display = Display.getDisplay(this) 。 / 获取 Display gw=new GameWorld(this) 。/ 创建游戏画布display.setCurrent(gw) 。/ 设置游戏画布为当前显示画面public void startApp() if(gw!=null)gw.start() 。 /游戏开始执行public void pauseApp() if(gw!=null)gw.setPaused(true)。 /游戏暂停执行public void destroyApp(boolean unconditional) if(g
3、w!=null)gw.stop()。 / 停止游戏循环/* 退出程序 */public void exit()trydestroyApp(false) 。catch(Exception e)notifyDestroyed() 。*GameDesign 。 Java/* * To change this template, choose Tools | Templates* and open the template in the editor.*/import javax.microedition.midlet.* 。import javax.microedition.lcdui.* 。imp
4、ort javax.microedition.lcdui.game.* 。import java.io.IOException 。/* author Administrator*/public class GameDesign /GEN-BEGIN:|fields|0| private Image TiledBG2 。private Image TiledBG 。public int Fireseq001Delay = 200 。public int Fireseq001 = 34, 35, 36, 35 。private TiledLayer BackGround 。public int F
5、ireBackGround 。private TiledLayer Build 。/GEN-END:|fields|0|/GEN-BEGIN:|methods|0| /GEN-END:|methods|0|public Image getTiledBG() throws java.io.IOException /GEN-BEGIN:|1-getter|0|1-preInit if (TiledBG = null) /GEN-END:|1-getter|0|1-preInit/ write pre-init user code hereTiledBG = Image.createImage(/T
6、iled.png) 。 /GEN-BEGIN:|1-getter|1|1-postInit /GEN-END:|1-getter|1|1-postInit/ write post-init user code herereturn this.TiledBG 。 /GEN-BEGIN:|1-getter|2|/GEN-END:|1-getter|2|public TiledLayer getBackGround() throws java.io.IOException /GEN-BEGIN:|2-getter|0|2- preInitif (BackGround = null) /GEN-END
7、:|2-getter|0|2-preInit/ write pre-init user code hereBackGround = new TiledLayer(20, 20, getTiledBG(), 32, 32) 。 /GEN-BEGIN:|2- getter|1|2-midInitFireBackGround = BackGround.createAnimatedTile(Fireseq0010) 。 int tiles = 2, 2, 1, 2, 2, 2, 2, 17, FireBackGround, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 , 2, 2,
8、 2, 2, 2, 2, 2, 26, 11, 11, 2, 1, 6, 2, 2, 2, 2, 2, 2, 2 , 10, 10, 10, 12, 7, 2, 2, 17, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 , 2, 2, FireBackGround, 17, 2, 2, 2, 17, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 , 6, 2, 2, 17, 2, 2, 2, 17, 2, 7, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2 , 2, 2, 2, 17, 2, 2, 2, 17, 2, 2, 2, 2
9、, 2, 2, 2, 2, 17, 2, 2, 2 , 2, 2, 2, 19, 11, 11, 11, 18, 11, 10, 12, 2, 2, 2, 2, 2, 17, 2, 2, 2 , 2, 2, 2, 2, 2, 2, 2, 2, 2, FireBackGround, 17, 2, 2, 2, 2, 2, 17, 2, 2, 2 , 1, 2, 2, 2, 2, 2, 2, 6, 2, 2, 17, 2, 2, 2, 2, 2, 17, 2, 6, 2 , 3, 3, 3, 3, 7, 3, 3, 3, 3, 3, 17, 3, 1, 3, 3, 3, 17, 3, 3, 3 ,
10、2, 6, FireBackGround, 2, 2, 2, 4, 4, 4, 4, 17, 4, 3, 3, 3, 3, 17, 3, 3, 3 , 2, 3, 9, 10, 10, 10, 10, 10, 10, 10, 18, 10, 10, 27, 10, 10, 18, 10, 10, 10 , 2, 2, 17, 2, 2, 2, 6, 4, 4, 4, 4, 4, 3, 17, 3, 3, 3, 3, 3, FireBackGround , 2, 2, 17, 2, 2, 2, 4, 4, 4, 4, 4, 4, 3, 17, 3, 1, 3, 3, 3, 3 , 2, 2, 1
11、7, 2, 2, 2, 4, 4, 4, 4, 4, 4, 3, 26, 11, 11, 11, 3, 3, 3 , 2, 2, 17, 2, 2, 2, 4, 4, 4, 4, 4, 4, 3, 17, 3, 3, 3, 3, 3, 3 , 2, 2, 17, 2, 1, 2, 4, 4, 4, 4, 17, 4, 3, 17, 3, 3, 3, 3, 3, 3 , 2, 2, 17, FireBackGround, 2, 2, 4, 4, 4, 4, 19, 10, 10, 20, 3, 3, 3, 3, 3, 3 , 2, 2, 17, 2, 2, 2, 4, 7, 4, 4, 4, 3
12、, 3, 3, 3, 6, 3, 3, 1, 3 , 6, 2, 17, 2, 2, 2, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3 。 /GEN-END:|2-getter|1|2-midInit/ write mid-init user code herefor (int row = 0 。 row 20 。 row+) /GEN-BEGIN:|2-getter|2|2-postInitfor (int col = 0 。 col 20 。 col+) BackGround.setCell(col, row, tilesrowcol) 。/GEN-E
13、ND:|2-getter|2|2-postInit/ write post-init user code herereturn BackGround 。 /GEN-BEGIN:|2-getter|3|/GEN-END:|2-getter|3|public TiledLayer getBuild() throws java.io.IOException /GEN-BEGIN:|6-getter|0|6-preInitif (Build = null) /GEN-END:|6-getter|0|6-preInit/ write pre-init user code hereBuild = new
14、TiledLayer(20, 20, getTiledBG(), 32, 32) 。 /GEN-BEGIN:|6-getter|1|6- midInitint tiles = 0, 0, 0, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 13, 0, 0, 69, 70, 71, 72, 0, 0 , 0, 43, 0, 0, 0, 31, 32, 0, 0, 0, 0, 0, 0, 0, 77, 78, 79, 80, 0, 0 , 0, 51, 0, 0, 0, 39, 40, 0, 0, 0, 0, 0, 0, 0, 85, 86, 87, 88, 13, 0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, 96, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,