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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? enemy1.java

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

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

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


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

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

		// Enemy1 borser vs. Enemy 2 borders
		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;
				}
			}
		}

		// Enemy 1 borders vd 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;
				}
			}
		}
		// Enemy1 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;
				}
			}
		}


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

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
8v天堂国产在线一区二区| 国产a区久久久| 国产在线播精品第三| 国产成人在线影院| 91麻豆免费在线观看| 欧美三级电影一区| 26uuu精品一区二区| 综合激情成人伊人| 婷婷开心久久网| 国产一区二区三区蝌蚪| 91欧美一区二区| 在线综合亚洲欧美在线视频| 欧美—级在线免费片| 亚洲午夜精品网| 国产乱理伦片在线观看夜一区| 91在线视频免费观看| 91精品国产综合久久精品麻豆| 国产欧美日韩另类一区| 亚洲成人精品影院| 风流少妇一区二区| 欧美日韩1234| 中文字幕亚洲在| 日本aⅴ精品一区二区三区| 成人app网站| 欧美电影精品一区二区| 亚洲女同女同女同女同女同69| 麻豆精品视频在线| 91福利精品视频| 国产日韩精品一区| 日本美女一区二区三区视频| 91视频一区二区三区| 久久久久久久久久久久久久久99| 亚洲国产美国国产综合一区二区| 国产99久久久久| 日韩免费高清av| 亚洲综合男人的天堂| 不卡一区二区在线| 欧美成人免费网站| 午夜电影网一区| 色猫猫国产区一区二在线视频| 久久久久一区二区三区四区| 天天影视涩香欲综合网| 91免费观看国产| 国产视频一区在线观看| 看片的网站亚洲| 欧美日精品一区视频| 一区二区三区精品| www.66久久| 国产婷婷一区二区| 精品一区二区三区视频在线观看| 欧美疯狂做受xxxx富婆| 一区二区在线观看视频在线观看| 成人做爰69片免费看网站| 亚洲精品在线三区| 日韩成人免费在线| 91.com在线观看| 亚洲高清一区二区三区| 欧美综合一区二区| 亚洲特级片在线| 成人app网站| 国产精品色哟哟网站| 国产高清在线精品| 久久久av毛片精品| 国产又粗又猛又爽又黄91精品| 91麻豆精品国产91久久久| 亚洲大尺度视频在线观看| 91麻豆免费在线观看| 亚洲免费看黄网站| 99re这里只有精品首页| 中文字幕一区二区三| 成人福利电影精品一区二区在线观看| 337p日本欧洲亚洲大胆精品 | 91视频观看视频| 中文字幕精品—区二区四季| 国产一区二区三区精品欧美日韩一区二区三区 | 日韩免费电影网站| 蜜桃视频在线一区| 精品国偷自产国产一区| 久久精品理论片| 久久久影院官网| 国产精品一区二区免费不卡| 久久久综合网站| 成人av资源在线观看| 亚洲人成网站精品片在线观看| 日本丶国产丶欧美色综合| 一区二区三区高清不卡| 欧美日韩视频在线观看一区二区三区| 亚洲一级不卡视频| 制服丝袜亚洲精品中文字幕| 激情综合亚洲精品| 久久久精品国产免费观看同学| 国产98色在线|日韩| 成人欧美一区二区三区小说| 91国产福利在线| 日韩电影在线观看一区| 日韩女同互慰一区二区| 国产精品一区二区三区99| 中文字幕在线不卡视频| 欧美午夜精品免费| 美女mm1313爽爽久久久蜜臀| 国产欧美日韩精品a在线观看| av综合在线播放| 亚洲高清三级视频| 日韩一区二区精品| 成人激情综合网站| 一区二区三区日本| 日韩一区二区在线播放| 高清av一区二区| 亚洲成人免费在线观看| 久久先锋影音av| 91在线观看下载| 日本最新不卡在线| 国产女同互慰高潮91漫画| 在线亚洲+欧美+日本专区| 久久精品国产99国产精品| 欧美经典三级视频一区二区三区| 欧美中文字幕亚洲一区二区va在线 | 成人动漫一区二区| 亚洲国产综合色| 久久夜色精品国产欧美乱极品| 波多野结衣在线一区| 天堂在线亚洲视频| 国产拍欧美日韩视频二区| 在线精品视频小说1| 极品少妇一区二区三区精品视频| 亚洲男人的天堂在线aⅴ视频| 日韩一区二区电影网| aaa国产一区| 精品一区二区三区影院在线午夜 | 欧美日韩精品系列| 成人污污视频在线观看| 天天色综合成人网| 国产精品国产三级国产a| 欧美一级黄色录像| 色哟哟国产精品免费观看| 韩国成人精品a∨在线观看| 亚洲色图欧美激情| 欧美v国产在线一区二区三区| 色94色欧美sute亚洲线路一ni | 久久综合资源网| 欧美中文字幕一二三区视频| 国产又粗又猛又爽又黄91精品| 亚洲国产精品综合小说图片区| 久久久国产午夜精品| 欧美三级蜜桃2在线观看| 不卡一区二区在线| 国内精品视频666| 亚洲第一福利一区| 综合网在线视频| www国产精品av| 这里只有精品电影| 欧美在线一区二区| 成人教育av在线| 国产一区二三区| 日本不卡123| 亚洲福利一二三区| 亚洲精品久久久蜜桃| 国产精品福利一区二区三区| 亚洲精品一区二区三区福利| 欧美色综合久久| 91原创在线视频| 成人av在线播放网址| 国产精品456| 九色综合国产一区二区三区| 三级影片在线观看欧美日韩一区二区| 亚洲日本欧美天堂| 国产精品大尺度| 国产精品视频yy9299一区| 久久久久一区二区三区四区| 久久综合999| 欧美成人aa大片| 日韩午夜在线影院| 欧美久久一区二区| 欧美日韩国产影片| 欧美亚洲国产bt| 色美美综合视频| 91福利在线免费观看| 色欧美片视频在线观看| 色婷婷精品久久二区二区蜜臂av| 99re视频这里只有精品| 成人理论电影网| 不卡视频一二三四| 欧美成人欧美edvon| 91精品福利在线一区二区三区| 欧美久久高跟鞋激| 91精品国产品国语在线不卡| 欧美日本免费一区二区三区| 欧美日韩激情一区二区三区| 欧美日韩精品三区| 欧美一区国产二区| 欧美一区二区福利在线| 日韩一区和二区| 欧美精品一区二区三区视频| 久久亚洲欧美国产精品乐播| 久久精品一区蜜桃臀影院| 欧美国产激情二区三区| 中文字幕一区二区三| 亚洲一区二区高清| 欧美aaaaa成人免费观看视频| 美女视频一区二区|