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

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

?? enemy3.java

?? 簡易的坦克程序
?? JAVA
字號:
import java.awt.*;

public class Enemy3{
	// 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 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 Enemy3(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;
		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++;

		// Enemy3 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;
		}


		// Enemy3 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;
		}

		// Enemy3 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;
				}
			}
		}

		// Enemy3 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;
				}
			}
		}
		// Enemy3 border vs. Enemy3 borders
		Rectangle Enemy3;
		for(int i = 0; i < e2.length; i++){
			if(e3[i] != null && i != index){
				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;
				}
			}
		}

		// Enemy3 border vs. enemie4 borders
		Rectangle Enemy4;
		for(int i = 0; i < e4.length; i++){
			if(e4[i] != null){
				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;
				}
			}
		}


		// Enemy3 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 = destination;
		if(flashing && falshingTime%10 > 4)
			ImageNo = destination + 4;
		return ImageNo;
	}

	public int getDirection(){
		return destination;
	}

	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精品国产综合久久精品性色| 欧美一区二区三区电影| 色哟哟精品一区| 日本高清不卡视频| 欧美精品高清视频| 制服丝袜亚洲色图| 综合激情网...| 麻豆一区二区三| 色偷偷成人一区二区三区91 | 中文字幕一区二区三区色视频 | 亚洲丰满少妇videoshd| 国产麻豆精品久久一二三| 风流少妇一区二区| 欧美日韩aaaaa| 中文字幕一区二区三区在线播放 | 成人av先锋影音| 欧美精品在线观看一区二区| 国产日韩综合av| 一区二区在线观看不卡| 亚洲成人资源在线| 成人国产精品免费网站| 日韩精品一区二区三区中文不卡| 国产精品网曝门| 午夜精品久久久久久久久久久 | 国产一区二区三区在线观看免费视频 | 日本丰满少妇一区二区三区| 久久香蕉国产线看观看99| 亚洲一二三级电影| 96av麻豆蜜桃一区二区| 久久综合给合久久狠狠狠97色69| 亚洲一区二区偷拍精品| 99视频有精品| 中文字幕的久久| 国产麻豆9l精品三级站| 精品久久久久久久久久久久包黑料| 亚洲日本在线a| 精品一区免费av| 欧美高清dvd| 亚洲午夜久久久久久久久久久| 成人天堂资源www在线| 精品国产髙清在线看国产毛片| 亚洲在线中文字幕| 白白色 亚洲乱淫| 国产精品人妖ts系列视频| 看电视剧不卡顿的网站| 91麻豆精品国产综合久久久久久 | 成人黄色免费短视频| 国产亚洲精品免费| 国产美女娇喘av呻吟久久| 精品美女一区二区| 国内精品久久久久影院薰衣草 | 色偷偷久久一区二区三区| 亚洲欧洲av一区二区三区久久| 国产99精品在线观看| 久久久久久一二三区| 美女高潮久久久| www精品美女久久久tv| 国产麻豆精品在线| 欧美高清在线视频| av午夜精品一区二区三区| 亚洲精品va在线观看| 欧美日韩国产精品成人| 亚洲va韩国va欧美va精品| 制服丝袜成人动漫| 国产在线观看免费一区| 久久五月婷婷丁香社区| 成人免费看黄yyy456| 自拍偷拍亚洲激情| 欧美无砖砖区免费| 日本美女一区二区三区视频| 久久综合999| 91小视频在线观看| 亚洲成人资源在线| 精品国产91洋老外米糕| 国产一区二区三区在线观看免费| 一色屋精品亚洲香蕉网站| 欧美自拍偷拍午夜视频| 精品亚洲免费视频| 中文字幕制服丝袜一区二区三区 | 欧美日韩一区二区三区不卡| 蜜桃久久久久久久| 国产精品欧美久久久久一区二区| 99re热视频这里只精品| 日韩黄色免费网站| 国产精品萝li| 日韩一区二区在线看片| 成人黄色电影在线| 日韩高清不卡在线| 国产精品成人免费| 日韩欧美视频一区| 91黄色在线观看| 韩国一区二区在线观看| 一二三四区精品视频| 欧美电影免费观看完整版| 色悠悠亚洲一区二区| 黑人巨大精品欧美黑白配亚洲| 亚洲视频一区二区在线观看| 在线精品视频一区二区| 国产乱子轮精品视频| 亚洲va欧美va人人爽| 国产精品色呦呦| 日韩免费在线观看| 欧美在线不卡视频| 成人午夜看片网址| 蜜桃视频在线观看一区二区| 亚洲精品乱码久久久久久黑人| 精品国精品国产| 91视视频在线直接观看在线看网页在线看| 一区二区三区视频在线看| 日本一区二区免费在线| 欧美一级久久久久久久大片| 欧亚洲嫩模精品一区三区| 成人激情校园春色| 国产最新精品精品你懂的| 丝袜亚洲另类欧美| 夜夜亚洲天天久久| 国产精品夫妻自拍| 中文字幕免费观看一区| 久久亚洲综合色一区二区三区| 欧美伦理电影网| 欧美在线免费播放| 91蜜桃在线观看| 99视频一区二区| 波多野结衣精品在线| 国产精品一卡二卡| 国产在线精品不卡| 国精产品一区一区三区mba视频 | 亚洲免费高清视频在线| 国产精品久久久久四虎| 久久久99免费| 久久综合狠狠综合久久激情| 欧美一级理论片| 欧美日韩精品一区二区| 欧美日韩国产三级| 欧美午夜电影网| 欧美日韩不卡在线| 91精品在线观看入口| 欧美一区二区精美| 精品久久人人做人人爱| 久久综合狠狠综合久久激情| 久久精品视频免费| 国产精品色哟哟网站| 中文字幕中文乱码欧美一区二区| 综合欧美一区二区三区| 怡红院av一区二区三区| 亚洲va欧美va人人爽午夜 | jvid福利写真一区二区三区| 国产麻豆午夜三级精品| 高清成人免费视频| 91麻豆视频网站| 欧美在线999| 日韩欧美成人一区二区| 国产三级久久久| 亚洲精品国产一区二区精华液| 亚洲成人av中文| 久久精品99国产精品| 国产精品影音先锋| 国产成人三级在线观看| 在线免费亚洲电影| 欧美不卡一二三| 亚洲一区二区三区免费视频| 国产成人精品影视| 日韩一区二区不卡| 亚洲精品成人a在线观看| 国产精品一二一区| 51精品国自产在线| 一区二区三区久久| 99这里都是精品| 久久一区二区三区四区| 日韩制服丝袜先锋影音| 91成人看片片| 自拍偷拍亚洲激情| 国产91露脸合集magnet| 日韩欧美一区在线| 亚洲午夜一区二区| eeuss鲁一区二区三区| 久久精品在线免费观看| 蜜臂av日日欢夜夜爽一区| 欧美午夜电影网| 亚洲精品免费看| 暴力调教一区二区三区| 国产日韩精品久久久| 精品一区二区三区不卡| 日韩一区二区在线看片| 三级欧美韩日大片在线看| 欧美三级欧美一级| 亚洲国产成人精品视频| 色欧美乱欧美15图片| 亚洲欧洲一区二区三区| 99视频热这里只有精品免费| 中文字幕免费不卡| 成人国产电影网| 亚洲国产精品国自产拍av| 国产精品 欧美精品| 欧美激情自拍偷拍| 成人网在线免费视频| 国产精品伦理在线| 91美女片黄在线观看91美女| 亚洲免费观看高清| 欧美日韩小视频|