📄 gamedesign.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */import javax.microedition.midlet.*;import javax.microedition.lcdui.*;import javax.microedition.lcdui.game.*;import java.io.IOException;/** * @author Administrator */public class GameDesign { //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0| private TiledLayer Things; private TiledLayer Things1; private Image topview_tiles; private TiledLayer Trees1; private Image platform_tiles; private TiledLayer Bask1; private Image zhuan; private TiledLayer Trees; private TiledLayer Water; private TiledLayer Water1; private Image water2; private Image base10; private TiledLayer Bask; private Image base12; private Image base11; private Image snow; //</editor-fold>//GEN-END:|fields|0| //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0| //</editor-fold>//GEN-END:|methods|0| public Image getTopview_tiles() throws java.io.IOException {//GEN-BEGIN:|2-getter|0|2-preInit if (topview_tiles == null) {//GEN-END:|2-getter|0|2-preInit // write pre-init user code here topview_tiles = Image.createImage("/topview_tiles.png");//GEN-BEGIN:|2-getter|1|2-postInit }//GEN-END:|2-getter|1|2-postInit // write post-init user code here return this.topview_tiles;//GEN-BEGIN:|2-getter|2| }//GEN-END:|2-getter|2| public Image getBase10() throws java.io.IOException {//GEN-BEGIN:|38-getter|0|38-preInit if (base10 == null) {//GEN-END:|38-getter|0|38-preInit // write pre-init user code here base10 = Image.createImage("/tank/base10.png");//GEN-BEGIN:|38-getter|1|38-postInit }//GEN-END:|38-getter|1|38-postInit // write post-init user code here return this.base10;//GEN-BEGIN:|38-getter|2| }//GEN-END:|38-getter|2| public TiledLayer getBask() throws java.io.IOException {//GEN-BEGIN:|39-getter|0|39-preInit if (Bask == null) {//GEN-END:|39-getter|0|39-preInit // write pre-init user code here Bask = new TiledLayer(13, 18, getBase10(), 20, 17);//GEN-BEGIN:|39-getter|1|39-midInit int[][] tiles = { { 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1 }, { 7, 8, 9, 10, 11, 12, 7, 8, 9, 10, 11, 12, 7 }, { 13, 14, 15, 16, 17, 18, 13, 14, 15, 16, 17, 18, 13 }, { 19, 20, 21, 22, 23, 24, 19, 20, 21, 22, 23, 24, 19 }, { 25, 26, 27, 28, 29, 30, 25, 26, 27, 28, 29, 30, 25 }, { 31, 32, 33, 34, 35, 36, 31, 32, 33, 34, 35, 36, 31 }, { 37, 38, 39, 40, 41, 42, 37, 38, 39, 40, 41, 42, 37 }, { 43, 44, 45, 46, 47, 48, 43, 44, 45, 46, 47, 48, 43 }, { 49, 50, 51, 52, 53, 54, 49, 50, 51, 52, 53, 54, 49 }, { 55, 56, 57, 58, 59, 60, 55, 56, 57, 58, 59, 60, 55 }, { 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1 }, { 7, 8, 9, 10, 11, 12, 7, 8, 9, 10, 11, 12, 7 }, { 13, 14, 15, 16, 17, 18, 13, 14, 15, 16, 17, 18, 13 }, { 19, 20, 21, 22, 23, 24, 19, 20, 21, 22, 23, 24, 19 }, { 25, 26, 27, 28, 29, 30, 25, 26, 27, 28, 29, 30, 25 }, { 31, 32, 33, 34, 35, 36, 31, 32, 33, 34, 35, 36, 31 }, { 37, 38, 39, 40, 41, 42, 37, 38, 39, 40, 41, 42, 37 }, { 43, 44, 45, 46, 47, 48, 43, 44, 45, 46, 47, 48, 43 } };//GEN-END:|39-getter|1|39-midInit // write mid-init user code here for (int row = 0; row < 18; row++) {//GEN-BEGIN:|39-getter|2|39-postInit for (int col = 0; col < 13; col++) { Bask.setCell(col, row, tiles[row][col]); } } }//GEN-END:|39-getter|2|39-postInit // write post-init user code here return Bask;//GEN-BEGIN:|39-getter|3| }//GEN-END:|39-getter|3| public Image getBase12() throws java.io.IOException {//GEN-BEGIN:|40-getter|0|40-preInit if (base12 == null) {//GEN-END:|40-getter|0|40-preInit // write pre-init user code here base12 = Image.createImage("/tank/base12.png");//GEN-BEGIN:|40-getter|1|40-postInit }//GEN-END:|40-getter|1|40-postInit // write post-init user code here return this.base12;//GEN-BEGIN:|40-getter|2| }//GEN-END:|40-getter|2| public Image getBase11() throws java.io.IOException {//GEN-BEGIN:|41-getter|0|41-preInit if (base11 == null) {//GEN-END:|41-getter|0|41-preInit // write pre-init user code here base11 = Image.createImage("/tank/base11.png");//GEN-BEGIN:|41-getter|1|41-postInit }//GEN-END:|41-getter|1|41-postInit // write post-init user code here return this.base11;//GEN-BEGIN:|41-getter|2| }//GEN-END:|41-getter|2| public void updateLayerManagerForSchool(LayerManager lm) throws java.io.IOException {//GEN-LINE:|44-updateLayerManager|0|44-preUpdate // write pre-update user code here getThings().setPosition(1, -45);//GEN-BEGIN:|44-updateLayerManager|1|44-postUpdate getThings().setVisible(true); lm.append(getThings()); getTrees().setPosition(80, 189); getTrees().setVisible(true); lm.append(getTrees()); getWater().setPosition(-56, 55); getWater().setVisible(true); lm.append(getWater()); getBask().setPosition(0, 0); getBask().setVisible(true); lm.append(getBask());//GEN-END:|44-updateLayerManager|1|44-postUpdate // write post-update user code here }//GEN-BEGIN:|44-updateLayerManager|2|//GEN-END:|44-updateLayerManager|2| public Image getSnow() throws java.io.IOException {//GEN-BEGIN:|55-getter|0|55-preInit if (snow == null) {//GEN-END:|55-getter|0|55-preInit // write pre-init user code here snow = Image.createImage("null");//GEN-BEGIN:|55-getter|1|55-postInit }//GEN-END:|55-getter|1|55-postInit // write post-init user code here return this.snow;//GEN-BEGIN:|55-getter|2| }//GEN-END:|55-getter|2| public Image getZhuan() throws java.io.IOException {//GEN-BEGIN:|67-getter|0|67-preInit if (zhuan == null) {//GEN-END:|67-getter|0|67-preInit // write pre-init user code here zhuan = Image.createImage("/tank/zhuan.png");//GEN-BEGIN:|67-getter|1|67-postInit }//GEN-END:|67-getter|1|67-postInit // write post-init user code here return this.zhuan;//GEN-BEGIN:|67-getter|2| }//GEN-END:|67-getter|2| public TiledLayer getThings() throws java.io.IOException {//GEN-BEGIN:|68-getter|0|68-preInit if (Things == null) {//GEN-END:|68-getter|0|68-preInit // write pre-init user code here Things = new TiledLayer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, 0, 0, 0, 0, 25, 26, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 35, 9, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 3, 34, 12, 3, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 23, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 22, 21, 22, 0, 0, 0, 0 }, { 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 28, 0, 0, 0 }, { 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0 }, { 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0 } };//GEN-END:|68-getter|1|68-midInit // write mid-init user code here for (int row = 0; row < 28; row++) {//GEN-BEGIN:|68-getter|2|68-postInit for (int col = 0; col < 20; col++) { Things.setCell(col, row, tiles[row][col]); } } }//GEN-END:|68-getter|2|68-postInit // write post-init user code here return Things;//GEN-BEGIN:|68-getter|3| }//GEN-END:|68-getter|3| public TiledLayer getWater() throws java.io.IOException {//GEN-BEGIN:|80-getter|0|80-preInit if (Water == null) {//GEN-END:|80-getter|0|80-preInit // write pre-init user code here Water = new TiledLayer(26, 30, getBase11(), 6, 6);//GEN-BEGIN:|80-getter|1|80-midInit int[][] tiles = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -