亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gamemap.java

?? 用java編寫的魔塔小游戲,經過應用很實用,運行良好
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;

public class GameMap
{
	//when animating,switch the dymatic pic 
	public static final int SWITCH_OFFSET = 44;
	public static final int TILE_WIDTH = 16;
	public static final int TILE_HEIGHT = TILE_WIDTH;//16;
	private static final int TILE_NUM_COL = 11;
	private static final int TILE_NUM_ROW = TILE_NUM_COL;//11;
	public static final int MAP_WIDTH = TILE_WIDTH*TILE_NUM_COL;
	public static final int MAP_HEIGHT = MAP_WIDTH;
	//hold the number of floors
	public static final int FLOOR_NUM = 22;
	//hold the number of tiles
	public static final int TILE_NUM = TILE_NUM_COL*TILE_NUM_ROW;
	//hold the position of hero,upstair = 0,downstair = 1.
	private static final int[][] heroPosition = {
	//floor 0,1,2,3,4...21
		{115,104,11,111,109,111,109,115,11,39,70,111,119,111,104,3,5, 93, 111,119,39,60},
		{16, 1,  99,109,99, 108,103,1,  51,83,99,119,111,114,5,  7,71,111,119,49, 71,60}
		};
	//judge the hero is upstair or downstair
	private int curUpDown = 0;

	//hold the current map that player in
	private int[] curFloorArray = new int[TILE_NUM];
	//hold the index of the floor that player in
	public int curFloorNum = 0;
	public int reachedHighest = 0;
	//public int curRow = 10,curCol = 5;
	private TiledLayer floorMap;
	private HeroSprite hero;
	//hold the ahead cell's index
	private int aheadIndex;
	//hold the ahead row and col;
	private int aheadCol,aheadRow;
	
	
	
	public GameMap(HeroSprite hero)
	{
		this.hero = hero;
		floorMap = new TiledLayer(
			TILE_NUM_COL,TILE_NUM_ROW,
			GameScreen.getImage(GameScreen.IMAGE_MAP),
			TILE_WIDTH,TILE_HEIGHT);
		setMap(curFloorNum);
	}
	
	public void setMap(int floorNum)
	{
		//floorMap.createAnimatedTile(6);
        //floorMap.createAnimatedTile(8);
	/*	switch (floor)
		{
			case 1: curFloor = floor1;break;
			case 2: curFloor = floor2;break;
		}
		
        for (int row=0; row<TILE_NUM_ROW; row++)
      		for (int col=0; col<TILE_NUM_COL; col++) 
      			floorMap.setCell(col,row,curFloor[row][col]);//*/
     /* for (int i=0; i < map.length; i++) {
      int column = i % 10;
      int row = (i - column) / 10;
      floorMap.setCell(column,row,map[i]);
      }*/
      for(int i = 0;i < TILE_NUM;i++)
      {
          curFloorArray[i] = floorArray[floorNum][i];
      }
/*      for (int i = 0;i < curFloorArray.length;i ++)
      {
      	//int column = i % TILE_NUM_COL;
      	//int row = (i - column) / TILE_NUM_ROW;
      	//floorMap.setCell(column,row,curFloorArray[i]);
      	int[] colrow = getColRow(i);
      	floorMap.setCell(colrow[0],colrow[1],curFloorArray[i]);
  		
      }
*/
	  for (int i = 0;i < TILE_NUM;i ++)
      {
      	int[] colrow = getColRow(i);
      	floorMap.setCell(colrow[0],colrow[1],floorArray[curFloorNum][i]);
  		
      }
      int[] colrow = getColRow(heroPosition[curUpDown][floorNum]);
      int x = (int)(colrow[0] * TILE_WIDTH + TILE_WIDTH / 2);
      int y = (int)(colrow[1] * TILE_HEIGHT + TILE_HEIGHT / 2);
      hero.setRefPixelPosition(x,y);
      	
	}
	private int[] getColRow(int index)
	{
		int[] result = new int[2];
		//col
		result[0] = index % TILE_NUM_COL;
		//row
		result[1] = (index - result[0]) / TILE_NUM_ROW;
		return result; 
	}
	public void animateMap()
	{
		/*if (floorMap.getAnimatedTile(-1) == MAP_STAR1)
		{
			floorMap.setAnimatedTile(-1,MAP_STAR2);
		}else
		{
			floorMap.setAnimatedTile(-1,MAP_STAR1);
		}
		
		if (floorMap.getAnimatedTile(-2) == MAP_WATER1)
		{
			floorMap.setAnimatedTile(-2,MAP_WATER2);
		}else
		{
			floorMap.setAnimatedTile(-2,MAP_WATER1);
		}*/
		int switchedCell;
		for(int i = 0;i < TILE_NUM;i ++){
			switchedCell = 0;
			int type = floorArray[curFloorNum][i];
			if(type == MAP_SHOP1){
				switchedCell = MAP_SHOP2;
			}else if(type == MAP_SHOP2){
				switchedCell = MAP_SHOP1;
			}else if(type == MAP_STAR1){
				switchedCell = MAP_STAR2;
			}else if(type == MAP_STAR2){
				switchedCell = MAP_STAR1;
			}else if(type == MAP_WATER1){
				switchedCell = MAP_WATER2;
			}else if(type == MAP_WATER2){
				switchedCell = MAP_WATER1;
			}else if((type >= MAP_ANGLE)&&(type <= MAP_ORGE31)){
				switchedCell =type + SWITCH_OFFSET;
			}else if(type > MAP_ORGE31){
				switchedCell =type - SWITCH_OFFSET;
			}
			if(switchedCell != 0){
				/*int[] colrow = getColRow(i);
				floorArray[curFloorNum][i] = switchedCell;
				floorMap.setCell(colrow[0],colrow[1],switchedCell);*/
				changeCell(i,switchedCell);				
			}
		}
		
	}
	
	public TiledLayer getFloorMap()
	{
		return floorMap;
	}
	
	public int upstair()
	{
		if ((curFloorNum + 1) < FLOOR_NUM)
		{
			curUpDown = 0;
			setMap(++curFloorNum);
			if(curFloorNum > reachedHighest)
				reachedHighest = curFloorNum;
		}
		return curFloorNum;	
	}
	
	public int downstair()
	{
		if ((curFloorNum - 1) >= 0)
		{
			curUpDown = 1;
			setMap(--curFloorNum);
		}
		return curFloorNum;
	}
	//return the value of the index in array
	public int canPass(int direction)
	{
		int col = hero.getRefPixelX() / TILE_WIDTH ;
		int row = hero.getRefPixelY() / TILE_HEIGHT ;
		//curCol = col; curRow = row;
		int result;
		boolean isBound = true;
		//System.out.println(Integer.toString(row)+"col:"+Integer.toString(col));
		//according to the direction to determine the ahead cell
		switch (direction)
		{
			case GameScreen.UP://row = ((row-1)>0) ? row-- : row;break;
				if(row-1>=0){row--;isBound = false;}break;
			case GameScreen.DOWN://row = ((row+1)<TILE_NUM_ROW) ? row++ : row;break;
				if(row+1<TILE_NUM_ROW){row++;isBound = false;}break;
			case GameScreen.LEFT://col = ((col-1)>0) ? col-- : col;break;
				if(col-1>=0){col--;isBound = false;}break;
			case GameScreen.RIGHT://col = ((col+1)<TILE_NUM_COL) ? col++ : col;break;
				if(col+1<TILE_NUM_COL){col++;isBound = false;}break;
		}
		if(isBound == true){result = 0;}else{
			aheadCol = col;
			aheadRow = row;
			aheadIndex = TILE_NUM_ROW * row + col;
	//		result = curFloorArray[aheadIndex];
			result = floorArray[curFloorNum][aheadIndex];
		}
			
		//System.out.println(Integer.toString(row)+"col:"+Integer.toString(col));
		//System.out.println(Integer.toString(curFloorArray[index]));
		return result;
	}
    public void changeCell(int index,int type)
    {
		int[] colrow = getColRow(index);
		floorArray[curFloorNum][index] = type;
		floorMap.setCell(colrow[0],colrow[1],type);		
    }

	//replace the current cell value with 1
	public void remove()
	{
		floorArray[curFloorNum][aheadIndex] = 1;
		floorMap.setCell(aheadCol,aheadRow,1);
	}
	public void remove(int floor,int index)
	{
		floorArray[floor][index] = 1;
	}
	public void remove(int floor,int index,int type)
	{
		floorArray[floor][index] = type;
	}
	public void jump(int floor)
	{
		if (reachedHighest >= floor){
			if(floor >= curFloorNum)curUpDown = 0;
			else curUpDown = 1;
			curFloorNum = floor;
			setMap(curFloorNum);
		}
	}
	//get the array of orge in current floor
	//result[TILE_NUM - 1] hold the number of orge
	public int[] getOrgeArray()
	{
		int[] result = new int[TILE_NUM];
		int type,num = 0;
		boolean repeated = false;
		for(int i = 0;i < TILE_NUM;i ++)
		{
			repeated = false;
			if((type = floorArray[curFloorNum][i]) >= FightCalc.MIN_ORGE_INDEX){
				if (type > FightCalc.MAX_ORGE_INDEX)type -= SWITCH_OFFSET;
				if(type < MAP_ORGE1)continue;
				//detect if repeated or not
				for(int j = 0;j < num;j ++)
				{
					if(result[j] == type){
						repeated = true;
						break;
					}
				}
				if(repeated == false){
					result[num] = type;
					//repeated = true;
					num++;//System.out.println(type+"  num="+num);
				}
			}
			
		}
		result[TILE_NUM-1] = num;
		return result;
	}
	
	public byte[] getFloorArray(int floor)
	{
		byte[] result = new byte[TILE_NUM];
		int type;
		for(int i = 0;i < TILE_NUM;i ++)
		{
			type = 	floorArray[floor][i];
			if (type > FightCalc.MAX_ORGE_INDEX)type -= SWITCH_OFFSET;
			result[i] = (byte)type;
		}
		return result;
	}
	
	public void setFloorArray(int floor,byte[] data)
	{
		for(int i = 0;i < TILE_NUM;i ++)
		{
			floorArray[floor][i] = data[i];
		}
	}
	
	private int[][] floorArray =
	{
//floor0
/*{
2,-1,-1,-1,-1,11,-1,-1,-1,-1,2,
2,-1,-1,-1,-1,1,-1,-1,-1,-1,2,
2,-1,-1,-1,-1,1,-1,-1,-1,-1,2,
2,-1,-1,-1,-1,1,-1,-1,-1,-1,2,
2,-1,-1,-1,-1,1,-1,-1,-1,-1,2,
2,-1,-1,-1,-1,1,-1,-1,-1,-1,2,
2,2,-1,-1,-1,1,-1,-1,-1,2,2,
2,2,2,2,2,1,2,2,2,2,2,
-2,2,-2,2,1,1,1,2,-2,2,-2,
-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,
-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2			
},*/
{
2,6,6,6,6,11,6,6,6,6,2,
2,6,6,6,6,1,6,6,6,6,2,
2,6,6,6,6,1,6,6,6,6,2,
2,6,6,6,6,1,6,6,6,6,2,
2,6,6,6,6,1,6,6,6,6,2,
2,6,6,6,6,1,6,6,6,6,2,
2,2,6,6,6,1,6,6,6,2,2,
2,2,2,2,2,13,2,2,2,2,2,
8,2,8,2,1,45,1,2,8,2,8,
8,8,8,8,8,1,8,8,8,8,8,
8,8,8,8,8,1,8,8,8,8,8
},
//floor1 
{
11,1,19,50,51,50,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,1,
23,1,53,13,1,2,23,19,23,2,1,
19,53,25,2,1,2,23,19,23,2,1,
2,13,2,2,1,2,2,2,54,2,1,
19,55,1,2,1,13,56,50,52,2,1,
26,1,20,2,1,2,2,2,2,2,1,
2,13,2,2,1,1,1,1,1,1,1,
1,55,1,2,2,15,2,2,2,13,2,
23,24,19,2,21,1,1,2,19,58,20,
23,36,19,2,1,12,1,2,19,19,19,		
},
//floor2
{
12,2,1,74,1,2,25,26,19,21,2,
1,2,26,2,24,2,25,26,19,20,2,
1,2,19,2,19,2,25,26,19,67,2,
1,2,19,2,19,2,2,2,2,13,2,
1,2,1,2,1,1,1,13,1,1,2,
1,2,13,2,2,13,2,2,13,2,2,
1,5,1,1,1,1,2,1,67,1,2,
1,2,13,2,2,14,2,16,2,16,2,
1,2,19,2,24,23,2,1,2,1,2,
1,2,19,2,24,23,2,1,2,1,2,
11,2,25,2,24,23,2,48,2,49,2
},
//floor3
{
27,51,19,2,3,17,4,2,2,2,2,
51,19,1,2,1,1,1,2,1,52,1,
19,53,1,2,2,13,2,2,1,2,1,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产高清一区二区三区蜜臀| 亚洲最新视频在线播放| 国产精品久久一卡二卡| 亚洲欧美日韩综合aⅴ视频| 麻豆久久久久久| 欧美本精品男人aⅴ天堂| 午夜久久久久久| 欧美一区二区成人6969| 日韩 欧美一区二区三区| 在线成人av影院| 同产精品九九九| 欧美一级生活片| 日本va欧美va瓶| 欧美精品一区在线观看| 精品一区二区三区久久| 久久精品人人做人人爽97| 国产成人午夜精品影院观看视频| 中文字幕精品一区二区三区精品| 成人av在线网站| 亚洲精品videosex极品| 欧美高清视频www夜色资源网| 日韩av不卡在线观看| 日韩欧美三级在线| 东方欧美亚洲色图在线| 亚洲四区在线观看| 欧美群妇大交群的观看方式| 蜜桃传媒麻豆第一区在线观看| 欧美精品一区二区三区很污很色的| 国产一区二区三区| 亚洲乱码国产乱码精品精的特点| 在线精品亚洲一区二区不卡| 青青草国产成人av片免费| 久久精品亚洲精品国产欧美kt∨| 成人黄色片在线观看| 亚洲一区二区三区四区五区黄| 欧美一级xxx| 成人一区在线看| 亚洲成人资源在线| 久久久久久久性| 在线观看视频一区| 国产老女人精品毛片久久| 日韩美女视频19| 日韩欧美国产综合一区| av在线综合网| 男男视频亚洲欧美| 亚洲激情成人在线| 精品国产三级电影在线观看| av午夜一区麻豆| 蜜桃av噜噜一区| 一区二区三区欧美在线观看| 色妹子一区二区| 九一九一国产精品| 亚洲影院理伦片| 欧美精品一区二区三区高清aⅴ| 成人av集中营| 奇米精品一区二区三区四区| 国产精品二三区| 日韩一区二区高清| jizz一区二区| 韩国v欧美v日本v亚洲v| 亚洲激情图片一区| 国产人成亚洲第一网站在线播放| 成人手机电影网| 天堂蜜桃一区二区三区| 欧美国产一区二区| 日韩欧美在线一区二区三区| 在线观看视频一区二区 | 久久精品国内一区二区三区| 国产亚洲精品超碰| 日韩精品专区在线| 欧美精品久久久久久久多人混战| 成人夜色视频网站在线观看| 美女一区二区三区| 亚洲国产精品一区二区www在线| 中文一区二区完整视频在线观看| 欧美一区二区私人影院日本| 91高清视频在线| 91一区在线观看| 成人动漫精品一区二区| 狠狠色狠狠色合久久伊人| 青青草91视频| 天天av天天翘天天综合网色鬼国产 | 欧美日韩视频不卡| 色噜噜偷拍精品综合在线| av不卡在线观看| 国产99久久久国产精品| 国产一区二区三区在线观看免费视频 | 《视频一区视频二区| 欧美国产综合一区二区| 国产三级一区二区| 久久久久久黄色| 精品国产伦一区二区三区观看方式| 欧美一级高清大全免费观看| 91精品欧美福利在线观看| 欧美剧情片在线观看| 欧美性受极品xxxx喷水| 欧美中文字幕一区二区三区亚洲| 色综合网色综合| av网站一区二区三区| 成人性生交大片| 风间由美一区二区av101 | 中文字幕国产精品一区二区| 国产欧美日韩精品在线| 国产日韩av一区| 国产精品色呦呦| 亚洲三级视频在线观看| 夜夜亚洲天天久久| 石原莉奈在线亚洲二区| 久久99日本精品| 成人污污视频在线观看| 不卡视频在线观看| 欧美日韩在线免费视频| 欧美一级在线视频| 555www色欧美视频| 欧美mv日韩mv国产网站| 久久久www成人免费毛片麻豆| 国产偷国产偷亚洲高清人白洁| 久久久久久久综合日本| 亚洲四区在线观看| 日本不卡中文字幕| 成人免费看视频| 欧美色综合网站| 久久嫩草精品久久久精品一| 国产精品国产自产拍在线| 亚洲一区在线电影| 久久er精品视频| 成人午夜精品一区二区三区| 91麻豆视频网站| 91精品久久久久久久久99蜜臂| 国产日韩欧美一区二区三区乱码 | 日韩精品一区二区在线| 国产精品久久一卡二卡| 亚洲成av人片在www色猫咪| 久久er精品视频| 91欧美一区二区| 精品盗摄一区二区三区| 亚洲精品国产第一综合99久久| 老司机午夜精品| 99久久国产综合精品色伊| 91精品国产欧美一区二区18| 亚洲国产高清在线观看视频| 天天综合网 天天综合色| 成人激情小说乱人伦| 777色狠狠一区二区三区| 自拍偷拍亚洲综合| 国内成+人亚洲+欧美+综合在线| 色呦呦国产精品| 久久久久国产精品人| 亚洲va欧美va人人爽| 成人一区二区三区| wwww国产精品欧美| 天天色 色综合| 91年精品国产| 欧美激情在线看| 婷婷开心激情综合| 成人av免费观看| 精品av综合导航| 国产欧美精品一区二区色综合朱莉| 午夜在线成人av| 欧美性猛片aaaaaaa做受| 久久久www成人免费无遮挡大片| 日韩成人一区二区三区在线观看| 91小视频免费看| 国产欧美日本一区二区三区| 美女网站色91| 91精品办公室少妇高潮对白| 最近日韩中文字幕| 国产成人在线免费观看| 337p日本欧洲亚洲大胆精品 | 自拍偷拍欧美精品| 国产精品自拍在线| 精品久久五月天| 美洲天堂一区二卡三卡四卡视频| 欧美性大战久久久久久久| 中文字幕一区二区不卡 | 亚洲精品中文在线观看| 成人av动漫网站| 国产精品免费视频观看| 丁香婷婷综合五月| 国产亚洲一区二区三区在线观看| 日本视频一区二区| 日韩三级免费观看| 美女mm1313爽爽久久久蜜臀| 欧美丰满少妇xxxxx高潮对白| 一区二区三区91| 91视频精品在这里| 亚洲国产欧美一区二区三区丁香婷| 日本韩国精品一区二区在线观看| 国产精品成人一区二区三区夜夜夜| 成人高清免费观看| 国产精品久久久一本精品| 国产成人综合在线播放| 久久综合给合久久狠狠狠97色69| 国产在线精品国自产拍免费| 久久久久国产精品麻豆ai换脸| 东方欧美亚洲色图在线| 一区二区三区视频在线看| 欧美三级电影网站| 日韩不卡免费视频| 2020国产成人综合网|