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

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

?? enemy4.java

?? 小時候經常玩的坦克游戲
?? JAVA
字號:
import java.awt.*;

public class Enemy4{
	// control varibles
	private final int UP = 0;
	private final int DOWN = 1;
	private final int LEFT = 2;
	private final int RIGHT = 3;
	// Physical information about the enemy tank
	private int speed;
	private int interval;
	private int destination = 1;
	private int status;
	private final int SIZE = 12;
	private int xPos, yPos, xVPos, yVPos;
	// borders
	private Rectangle E1, EV1;
	private Rectangle border = new Rectangle(10, 10, 502, 502);
	// others
	private boolean flashing;
	private int falshingTime = 0;

//====================================== the construct method ================================

	public Enemy4(int a, int b){
		if((int)(Math.random()*10) > 6)
			destination = (int)(Math.random()*4);
		interval = (int)(Math.random()*300);
		xPos = a;
		yPos = b;
		xVPos = a;
		yVPos = b;
		status = 0;
		E1 = new Rectangle(xPos - SIZE, yPos - SIZE, 25, 25);
		EV1 =  new Rectangle(xVPos - SIZE, yVPos - SIZE, 25, 25);
	}

//================================================ move ======================================

	public void move(Tank tank, Enemy1[] e1, Enemy2[] e2, Enemy3[] e3, Enemy4[] e4, int index, wall[] Wall, Steelwall[] SteelWall, river[] River, int timestop){
		if(speed < 2)
			speed++;

		if(flashing)
			falshingTime++;

		// Enemy4 border vs. environment border
		boolean notoutofborder = true;
		if(xPos - SIZE - speed < border.x + 1 && destination == LEFT){
			xPos = border.x + 1 + SIZE;
			notoutofborder = false;
		}
		if(xPos + SIZE + speed> border.x + border.width - 1 && destination == RIGHT){
			xPos = border.x + border.width - 2 - SIZE;
			notoutofborder = false;
		}
		if(yPos - SIZE - speed < border.y + 1 && destination == UP){
			yPos = border.y + 1 + SIZE;
			notoutofborder = false;
		}
		if(yPos + SIZE + speed> border.y + border.height - 1 && destination == DOWN){
			yPos = border.y + border.height - 2 - SIZE;
			notoutofborder = false;
		}


		// Enemy4 border vs. Tank border
		boolean canmoveup = true, canmovedown = true, canmoveleft = true, canmoveright = true;
		Rectangle tankborder = tank.getBorder();
		if(tankborder.contains(xPos + 1, yPos - 12 - speed) || tankborder.contains(xPos - 1, yPos - 12 - speed)){
			canmoveup = false;
			while(destination == 0)
				destination = (int)(Math.random()*4);
			yPos = tank.getyPos() + 25;
		}
		if(tankborder.contains(xPos + 1, yPos + 12 + speed) || tankborder.contains(xPos - 1, yPos + 12 + speed)){
			canmovedown = false;
			while(destination == 1)
				destination = (int)(Math.random()*4);
			yPos = tank.getyPos() - 25;
		}
		if(tankborder.contains(xPos - 12 - speed, yPos + 1) || tankborder.contains(xPos - 12 - speed, yPos - 1)){
			canmoveleft = false;
			while(destination == 2)
				destination = (int)(Math.random()*4);
			xPos = tank.getxPos() + 25;
		}
		if(tankborder.contains(xPos + 12 + speed, yPos + 1) || tankborder.contains(xPos + 12 + speed, yPos - 1)){
			canmoveright = false;
			while(destination == 3)
				destination = (int)(Math.random()*4);
			xPos =tank.getxPos() - 25;
		}

		// Enemy4 border vs. enemie1 borders
		Rectangle Enemy1;
		for(int i = 0; i < e1.length; i++){
			if(e1[i] != null){
				Enemy1 = e1[i].getE1();
				if(Enemy1.contains(xPos + 1, yPos - 12 - speed) || Enemy1.contains(xPos - 1, yPos - 12 - speed)){
					canmoveup = false;
					while(destination == 0)
						destination = (int)(Math.random()*4);
					yPos = e1[i].getyVPos() + 25;
				}
				if(Enemy1.contains(xPos + 1, yPos + 12 + speed) || Enemy1.contains(xPos - 1, yPos + 12 + speed)){
					canmovedown = false;
					while(destination == 1)
						destination = (int)(Math.random()*4);
					yPos = e1[i].getyVPos() - 25;
				}
				if(Enemy1.contains(xPos - 12 - speed, yPos + 1) || Enemy1.contains(xPos - 12 - speed, yPos - 1)){
					canmoveleft = false;
					while(destination == 2)
						destination = (int)(Math.random()*4);
					xPos = e1[i].getxVPos() + 25;
				}
				if(Enemy1.contains(xPos + 12 + speed, yPos + 1) || Enemy1.contains(xPos + 12 + speed, yPos - 1)){
					canmoveright = false;
					while(destination == 3)
						destination = (int)(Math.random()*4);
					xPos = e1[i].getxVPos() - 25;
				}
			}
		}

		// Enemy4 border vs. Enemy2 border
		Rectangle Enemy2;
		for(int i = 0; i < e2.length; i++){
			if(e2[i] != null){
				Enemy2 = e2[i].getE1();
				if(Enemy2.contains(xPos + 1, yPos - 12 - speed) || Enemy2.contains(xPos - 1, yPos - 12 - speed)){
					canmoveup = false;
					while(destination == 0)
						destination = (int)(Math.random()*4);
					yPos = e2[i].getyVPos() + 25;
				}
				if(Enemy2.contains(xPos + 1, yPos + 12 + speed) || Enemy2.contains(xPos - 1, yPos + 12 + speed)){
					canmovedown = false;
					while(destination == 1)
						destination = (int)(Math.random()*4);
					yPos = e2[i].getyVPos() - 25;
				}
				if(Enemy2.contains(xPos - 12 - speed, yPos + 1) || Enemy2.contains(xPos - 12 - speed, yPos - 1)){
					canmoveleft = false;
					while(destination == 2)
						destination = (int)(Math.random()*4);
					xPos = e2[i].getxVPos() + 25;
				}
				if(Enemy2.contains(xPos + 12 + speed, yPos + 1) || Enemy2.contains(xPos + 12 + speed, yPos - 1)){
					canmoveright = false;
					while(destination == 3)
						destination = (int)(Math.random()*4);
					xPos = e2[i].getxVPos() - 25;
				}
			}
		}
		// Enemy4 border vs. Enemy3 borders
		Rectangle Enemy3;
		for(int i = 0; i < e3.length; i++){
			if(e3[i] != null){
				Enemy3 = e3[i].getE1();
				if(Enemy3.contains(xPos + 1, yPos - 12 - speed) || Enemy3.contains(xPos - 1, yPos - 12 - speed)){
					canmoveup = false;
					while(destination == 0)
						destination = (int)(Math.random()*4);
					yPos = e3[i].getyVPos() + 25;
				}
				if(Enemy3.contains(xPos + 1, yPos + 12 + speed) || Enemy3.contains(xPos - 1, yPos + 12 + speed)){
					canmovedown = false;
					while(destination == 1)
						destination = (int)(Math.random()*4);
					yPos = e3[i].getyVPos() - 25;
				}
				if(Enemy3.contains(xPos - 12 - speed, yPos + 1) || Enemy3.contains(xPos - 12 - speed, yPos - 1)){
					canmoveleft = false;
					while(destination == 2)
						destination = (int)(Math.random()*4);
					xPos = e3[i].getxVPos() + 25;
				}
				if(Enemy3.contains(xPos + 12 + speed, yPos + 1) || Enemy3.contains(xPos + 12 + speed, yPos - 1)){
					canmoveright = false;
					while(destination == 3)
						destination = (int)(Math.random()*4);
					xPos = e3[i].getxVPos() - 25;
				}
			}
		}
		// Enemy4 border vs. Enemy4 borders
		Rectangle Enemy4;
		for(int i = 0; i < e4.length; i++){
			if(e4[i] != null && i != index){
				Enemy4 = e4[i].getE1();
				if(Enemy4.contains(xPos + 1, yPos - 12 - speed) || Enemy4.contains(xPos - 1, yPos - 12 - speed)){
					canmoveup = false;
					while(destination == 0)
						destination = (int)(Math.random()*4);
					yPos = e4[i].getyVPos() + 25;
				}
				if(Enemy4.contains(xPos + 1, yPos + 12 + speed) || Enemy4.contains(xPos - 1, yPos + 12 + speed)){
					canmovedown = false;
					while(destination == 1)
						destination = (int)(Math.random()*4);
					yPos = e4[i].getyVPos() - 25;
				}
				if(Enemy4.contains(xPos - 12 - speed, yPos + 1) || Enemy4.contains(xPos - 12 - speed, yPos - 1)){
					canmoveleft = false;
					while(destination == 2)
						destination = (int)(Math.random()*4);
					xPos = e4[i].getxVPos() + 25;
				}
				if(Enemy4.contains(xPos + 12 + speed, yPos + 1) || Enemy4.contains(xPos + 12 + speed, yPos - 1)){
					canmoveright = false;
					while(destination == 3)
						destination = (int)(Math.random()*4);
					xPos = e4[i].getxVPos() - 25;
				}
			}
		}


		// Enemy4 border vs. obstacles borders
		boolean nottouchobstacles = true;
		Rectangle[] Wallborder = new Rectangle[4];
		for(int j = 0; j < Wall.length; j++){
			if(Wall[j] != null){
				Wallborder = Wall[j].detailborder();
				for(int i = 0; i < 4; i++){
					if(Wallborder[i] != null){
						if(E1.intersects(Wallborder[i])){
							if(yPos - SIZE - 7 - speed <= Wallborder[i].y + 6 && destination == 0){
								canmoveup = false;
								nottouchobstacles = false;
								break;
							}
							if(yPos + SIZE + 7 + speed >= Wallborder[i].y + 6 && destination == 1){
								canmovedown = false;
								nottouchobstacles = false;
								break;
							}
							if(xPos - SIZE - 7 - speed <= Wallborder[i].x + 6 && destination == 2){
								canmoveleft = false;
								nottouchobstacles = false;
								break;
							}
							if(xPos + SIZE + 7 + speed >= Wallborder[i].x + 6 && destination == 3){
								canmoveright = false;
								nottouchobstacles = false;
								break;
							}
						}
					}
				}
			}
		}
		for(int j = 0; j < SteelWall.length; j++){
			if(SteelWall[j] != null){
				Wallborder = SteelWall[j].detailborder();
				for(int i = 0; i < 4; i++){
					if(Wallborder[i] != null){
						if(E1.intersects(Wallborder[i])){
							if(yPos - SIZE - 7 - speed <= Wallborder[i].y + 6 && destination == 0){
								canmoveup = false;
								nottouchobstacles = false;
								break;
							}
							if(yPos + SIZE + 7 + speed >= Wallborder[i].y + 6 && destination == 1){
								canmovedown = false;
								nottouchobstacles = false;
								break;
							}
							if(xPos - SIZE - 7 - speed <= Wallborder[i].x + 6 && destination == 2){
								canmoveleft = false;
								nottouchobstacles = false;
								break;
							}
							if(xPos + SIZE + 7 + speed >= Wallborder[i].x + 6 && destination == 3){
								canmoveright = false;
								nottouchobstacles = false;
								break;
							}
						}
					}
				}
			}
		}






		// move
		if(timestop >= 1)
			speed = 0;
		if(notoutofborder && nottouchobstacles){
			if(destination == UP && canmoveup)
				yPos = yPos - speed;
			if(destination == DOWN && canmovedown)
				yPos = yPos + speed;
			if(destination == LEFT && canmoveleft)
				xPos = xPos - speed;
			if(destination == RIGHT && canmoveright)
				xPos = xPos + speed;
			interval = interval - speed;
		}

		for(int i = 0; i < River.length; i++){
			if((River[i].Riverborder()).intersects(E1)){
				xPos = xVPos;
				yPos = yVPos;
				nottouchobstacles = false;
			}
		}

		//change the movement if the enemy tank meet anything that stop its movement
		if(!notoutofborder || !nottouchobstacles || interval <= 0){
			if((int)(Math.random()*10) > 8)
				destination = (int)(Math.random()*4);
			if(destination == 1 || destination == 0)
				xPos = xVPos;
			if(destination == 2 || destination == 3)
				yPos = yVPos;
			interval = (int)(Math.random()*300);
		}

		// the graphical border of the tank
		E1 = new Rectangle(xPos - SIZE, yPos - SIZE, 25, 25);

		// the virtual border of the tank
		int a = (xPos - 10)/25;
		int b = (xPos - 10)%25;
		if(b < 7)
			b = 0;
		if(b > 18)
			b = 25;
		if((b < 19 && b > 6) || xPos < 17 || xPos > 492)
			b = 13;
		xVPos = a*25 + b + 10;
		int c = (yPos - 10)/25;
		int d = (yPos - 10)%25;
		if(d < 7)
			d = 0;
		if(d > 18)
			d = 25;
		if((d < 19 && d > 6) || yPos < 17 || yPos > 492)
			d = 13;
		yVPos = c*25 + d + 10;
		EV1 =  new Rectangle(xVPos - SIZE, yVPos - SIZE, 25, 25);
	}

//========================================= other help methods ===============================
	public int getImageNo(){
		int ImageNo = status*4 + destination;
		if(flashing && falshingTime%10 > 4)
			ImageNo = destination + 16;
		return ImageNo;
	}

	public void stopFlashing(){
		flashing = false;
	}

	public int getStatus(){
		return status;
	}

	public int getDirection(){
		return destination;
	}

	public void hurt(){
		status++;
	}

	public Rectangle getE1(){
		return E1;
	}

	public Rectangle getEV1(){
		return EV1;
	}

	public int getxPos(){
		return xPos;
	}

	public int getyPos(){
		return yPos;
	}

	public int getxVPos(){
		return xVPos;
	}

	public int getyVPos(){
		return yVPos;
	}

	public void flashing(){
		flashing = true;
	}

	public boolean isFlashing(){
		return flashing;
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线视频国内自拍亚洲视频| 国模冰冰炮一区二区| 亚洲精品一区二区三区香蕉| 91久久免费观看| 高清不卡一区二区| 黄一区二区三区| 日韩av中文在线观看| 亚洲成人av在线电影| 亚洲精品一二三| 最新日韩av在线| 国产精品污污网站在线观看| 精品成人一区二区| 欧美一区二区大片| 欧美成人官网二区| 精品国产青草久久久久福利| 91精品国产综合久久久蜜臀粉嫩 | 国产精品自产自拍| 国产精品夜夜嗨| 精品在线播放免费| 久久精品国产精品亚洲精品| 精品一区二区三区不卡| 精品一区二区三区在线播放| 狠狠色狠狠色综合系列| 国产精品自拍三区| 日本精品一区二区三区高清| 一本色道亚洲精品aⅴ| 欧美体内she精高潮| 日韩视频免费直播| 亚洲一区在线观看视频| 国产免费成人在线视频| 成人伦理片在线| 国产高清在线观看免费不卡| 欧美性感一区二区三区| 国产精品全国免费观看高清 | 一区二区高清视频在线观看| 亚洲精品老司机| 久久国产精品色| 狠狠狠色丁香婷婷综合久久五月| 精品一区二区三区久久久| 国产精品99久久久久久久女警| 99re视频这里只有精品| 欧美精品久久99久久在免费线| 在线观看一区二区视频| 欧美日韩性生活| 精品国产一区二区亚洲人成毛片| 国产精品伦一区二区三级视频| 欧美aaaaaa午夜精品| 成人免费视频视频| 精品成人一区二区| 伦理电影国产精品| 欧美午夜精品免费| 色老头久久综合| 亚洲福利一区二区| 精品久久免费看| 精品系列免费在线观看| 欧美三级日韩三级| 三级亚洲高清视频| 亚洲激情自拍视频| 91在线观看视频| 中文字幕亚洲电影| 成人午夜免费电影| 国产精品美女久久久久aⅴ| 美女视频免费一区| 日韩欧美国产不卡| 久久国产精品99久久久久久老狼 | 国产精品毛片高清在线完整版| 青青草原综合久久大伊人精品 | 欧美电影免费观看完整版| 亚洲免费观看高清在线观看| 午夜久久久久久久久久一区二区| 久久99精品视频| 日韩亚洲电影在线| 国产激情视频一区二区三区欧美 | 国产三级一区二区| 色综合天天综合狠狠| 亚洲成人中文在线| 日韩一区二区三免费高清| 老司机午夜精品99久久| 久久久久亚洲蜜桃| 91久久精品一区二区| 天堂成人国产精品一区| 久久先锋影音av| 91免费在线视频观看| 日韩av高清在线观看| 欧美韩国一区二区| 日本韩国欧美在线| 91精品福利在线一区二区三区| 美女一区二区视频| 国产精品进线69影院| 91超碰这里只有精品国产| 男人的天堂久久精品| 亚洲私人影院在线观看| 7777精品久久久大香线蕉| 国产91富婆露脸刺激对白| 亚洲福利一区二区三区| 亚洲婷婷综合久久一本伊一区| 91精品欧美一区二区三区综合在 | 天天亚洲美女在线视频| 国产精品对白交换视频| 日韩欧美一区二区久久婷婷| 亚洲国产精品久久久久婷婷884| 欧美偷拍一区二区| 欧美日韩高清在线播放| 国产毛片一区二区| 久久国产精品99久久久久久老狼| 一区二区三区四区不卡在线| 久久新电视剧免费观看| 欧美成人午夜电影| 91麻豆精品国产无毒不卡在线观看| 91视视频在线观看入口直接观看www| 狠狠色2019综合网| 精品午夜一区二区三区在线观看| 午夜影院在线观看欧美| 五月激情综合婷婷| 午夜成人免费电影| 午夜视频在线观看一区| 亚洲综合成人在线视频| 亚洲一区二区三区激情| 亚洲二区在线视频| 日韩电影免费在线观看网站| 日韩av中文字幕一区二区| 久热成人在线视频| 国产99精品在线观看| 99热在这里有精品免费| 欧美日韩综合不卡| 欧美不卡视频一区| 国产精品乱人伦| 亚洲图片一区二区| 美洲天堂一区二卡三卡四卡视频| 国产在线日韩欧美| 91亚洲精品久久久蜜桃网站 | 亚洲伦理在线免费看| 偷拍亚洲欧洲综合| 国产.精品.日韩.另类.中文.在线.播放| 国产风韵犹存在线视精品| av一二三不卡影片| 538prom精品视频线放| 2020日本不卡一区二区视频| 国产精品污污网站在线观看| 亚洲不卡在线观看| 91小宝寻花一区二区三区| 欧美三级欧美一级| 欧美极品另类videosde| 亚洲精品国产视频| 成人国产精品免费观看| 欧美本精品男人aⅴ天堂| 亚洲人成影院在线观看| 国产精品一区二区久久不卡| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 欧美一区二区三区影视| 亚洲黄色免费网站| 成人黄色免费短视频| 欧美zozozo| 免费高清不卡av| 欧美韩日一区二区三区| 日韩电影免费在线观看网站| 91视频在线观看免费| 中文字幕精品一区二区精品绿巨人 | 不卡视频在线观看| 久久久久亚洲综合| 国产91精品露脸国语对白| 91精品国产综合久久福利| 亚洲精品少妇30p| 91麻豆蜜桃一区二区三区| 中文字幕精品综合| 春色校园综合激情亚洲| 久久天天做天天爱综合色| 看片的网站亚洲| 精品日产卡一卡二卡麻豆| 秋霞电影一区二区| 久久亚洲一区二区三区明星换脸 | 午夜激情一区二区| 91精品国产综合久久小美女| 日本欧美加勒比视频| 久久综合九色综合久久久精品综合 | 亚洲国产精品尤物yw在线观看| 国产精品久久久久永久免费观看| 国产成人精品一区二| 久久精品人人做| 97精品电影院| 日韩激情一二三区| 久久精品这里都是精品| 99精品视频免费在线观看| 天天色天天操综合| 久久久综合激的五月天| 色偷偷88欧美精品久久久| 亚洲第一成年网| 一区二区三区在线观看动漫| 欧美在线视频日韩| 精品一区二区三区不卡| 亚洲人精品午夜| 精品捆绑美女sm三区| 成人a区在线观看| 日韩黄色免费电影| 欧美激情资源网| 91精品国产入口| 一本一道久久a久久精品综合蜜臀| 免费久久99精品国产| 一区二区三区日韩在线观看| 久久女同精品一区二区|