⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 board.java

📁 j2me 手机游戏
💻 JAVA
字号:
import javax.microedition.lcdui.*;//--------------------------------------------------------------------------------------------------------//游戏名称: 仙剑奇侠传//作者: 张卫国//E-mail: weiguo2000@hotmail.com//创建于:2006/7/18--2006/8/3  by Weiguo////--------------------------------------------------------------------------------------------------------public class Board {  public  Map 		map;   private Character hero = null;    private int 		numberOfMaps = 1;  private boolean 	hee  = false;    public Board() {	  map = new Map();	  map.setMap(1);  }    public void putCharacter(Character c) {      hero = c;  }   public void createMap(int numberOfMaps) {	  this.numberOfMaps = numberOfMaps;	  map.setMap(numberOfMaps);  }    public int getnNumberOfMap(){	  return numberOfMaps;  }   public void draw( int xtmp, int ytmp, Graphics g) {	  	  /*int k1=0;	  for(int j1 = -12; j1 < 200 + 24; j1 += 12)      {          for(int i1 = ((-k1 % 2) * 48) / 2; i1 < 176 + 48; i1 += 48)                                g.drawImage(XianJianImage.image[59], i1, j1, 0);          k1++;      }*/	  if(map.layer01!=null){			for(int i=0;i<map.layer01.length;i++){				for(int j=0;j<map.layer01[0].length;j++){						if(map.layer01[i][j]>=0){						g.drawImage(XianJianImage.image[map.layer01[i][j]],xtmp+j*map.cellw/2-i*map.cellw/2,ytmp+j*map.cellh/2+i*map.cellh/2+26,Graphics.LEFT|Graphics.TOP);					}								}						}		  }	  if(map.layer0!=null){		for(int i=0;i<map.layer0.length;i++){			for(int j=0;j<map.layer0[0].length;j++){					if(map.layer0[i][j]>=0){					g.drawImage(XianJianImage.image[map.layer0[i][j]],xtmp+j*map.cellw/2-i*map.cellw/2,ytmp+j*map.cellh/2+i*map.cellh/2,Graphics.LEFT|Graphics.TOP);				}							}					}	  }	  if(map.layer1!=null){		  for(int i=0;i<map.layer1.length;i++){				for(int j=0;j<map.layer1[0].length;j++){						if(map.layer1[i][j]>=0){						g.drawImage(XianJianImage.image[map.layer1[i][j]],xtmp+j*map.cellw/2-i*map.cellw/2,ytmp+j*map.cellh/2+i*map.cellh/2-26,Graphics.LEFT|Graphics.TOP);					}								}						}	  }	  	  if(map.scene1!=null){			for(int i=0;i<map.scene1.length;i++){				g.drawRegion(XianJianImage.image[map.scene1[i][0]],map.scene1[i][1],map.scene1[i][2],map.scene1[i][3],map.scene1[i][4],map.scene1[i][5],xtmp+map.scene1[i][6],ytmp+map.scene1[i][7]-26,Graphics.LEFT|Graphics.TOP);							}	  }	  	  	  if(map.scene!=null){		for(int i=0;i<map.scene.length;i++){			if(map.scene[i][0]==4){				if((hero.x-7>map.scene[i][6]&&hero.x-7<map.scene[i][6]+map.scene[i][3]&&hero.y>map.scene[i][7]&&hero.y<map.scene[i][7]+88)||						(hero.x+7>map.scene[i][6]&&hero.x+7<map.scene[i][6]+map.scene[i][3]&&hero.y>map.scene[i][7]&&hero.y<map.scene[i][7]+88) ){											if(!hee)						hero.draw(xtmp,ytmp,g);						hee=true;					}			}else			if((hero.x-7>map.scene[i][6]&&hero.x-7<map.scene[i][6]+map.scene[i][3]&&hero.y>map.scene[i][7]&&hero.y<map.scene[i][7]+map.scene[i][4])||				(hero.x+7>map.scene[i][6]&&hero.x+7<map.scene[i][6]+map.scene[i][3]&&hero.y>map.scene[i][7]&&hero.y<map.scene[i][7]+map.scene[i][4]) ){			                                                                                                                              				if(!hee)				hero.draw(xtmp,ytmp,g);				hee=true;			}						g.drawRegion(XianJianImage.image[map.scene[i][0]],map.scene[i][1],map.scene[i][2],map.scene[i][3],map.scene[i][4],map.scene[i][5],xtmp+map.scene[i][6],ytmp+map.scene[i][7],Graphics.LEFT|Graphics.TOP);					}	  }	  if(map.scene01!=null){			for(int i=0;i<map.scene01.length;i++){				g.drawRegion(XianJianImage.image[map.scene01[i][0]],map.scene01[i][1],map.scene01[i][2],map.scene01[i][3],map.scene01[i][4],map.scene01[i][5],xtmp+map.scene01[i][6],ytmp+map.scene01[i][7],Graphics.LEFT|Graphics.TOP);							}	  }	  if(!hee)		  hero.draw(xtmp,ytmp,g); 	  hee=false;  }    	public int[] getCell(int x1, int y1) {  		int x = x1-24;  		int y = y1;	    int[] cell = new int[2];	    int tmpcellx = y+x/2;	    int tmpcelly = y-x/2;	    cell[0] = tmpcellx/12;	    cell[1] = tmpcelly/12;	    return cell;	  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -