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

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

?? enemy.java

?? 一個基于Java的小游戲
?? JAVA
字號:
import java.awt.*;public class Enemy {	// Constants to represent the direction of the Enemy	private final int LEFT =  0;	private final int RIGHT = 1;	private final int UP =    2;	private final int DOWN =  3;	// The size of the Enemy.	private final int SIZE = 8;	private boolean isVillain;	//The colour of the enemy;	private final int GREEN = 1;	private final int RED =   2;	private int color;	private int xPos, yPos;	private int direction;	private int destX, destY; // The random destination position	private int goldX, goldY;	//The speed of the Enemy	private final int SPEED = 5;	public Enemy(){		xPos = 20;		yPos = 20;		isVillain = false;		setDestinationPosition();	}	public Enemy (int x, int y, boolean isRedVillain) {		xPos = x;		yPos = y;		direction = UP;		isVillain = isRedVillain;		setDestinationPosition();		if(isVillain){			color = RED;		}else{			color = GREEN;		}	}	private void setDestinationPosition(){		if(isVillain){			destX = goldX;			destY = goldY;		}else{			destX = (int)(Math.random() * 440 + 10);			destY = (int)(Math.random() * 440 + 10);		}	}	public void setGoldPosition(int x, int y){		goldX = x;		goldY = y;	}	private void setDirection(){		if(isVillain){			if(goldX < xPos - SIZE){				direction = LEFT;			}else if(goldX > xPos + SIZE){				direction = RIGHT;			}else{				if(goldY < yPos - SIZE){					direction = UP;				}else if(goldY > yPos + SIZE){					direction = DOWN;				}else{					setDestinationPosition();					return;				}			}		}else{			if(destX < xPos - SIZE){				direction = LEFT;			}else if(destX > xPos + SIZE){				direction = RIGHT;			}else{				if(destY < yPos - SIZE){					direction = UP;				}else if(destY > yPos + SIZE){					direction = DOWN;				}else{					setDestinationPosition();					return;				}			}		}	}	//Pass the position of the enemy.	public int getX(){		return xPos - SIZE;	}	public int getY(){		return yPos - SIZE;	}	public int getSize(){		return SIZE;	}	private boolean isGotDestinationPoint(){		if(isVillain){			Point destinationPoint;			Rectangle villainBox;			destinationPoint = new Point(goldX,goldY);			villainBox = new Rectangle(xPos - SIZE, yPos - SIZE, SIZE * 2, SIZE * 2);			return villainBox.contains(destinationPoint);		}		if(isVillain == false){			Point destinationPoint;			Rectangle enemyBox;			destinationPoint = new Point(destX, destY);			enemyBox = new Rectangle(xPos - SIZE, yPos - SIZE, SIZE * 2, SIZE * 2);			return enemyBox.contains(destinationPoint);		}		return false;	}	//To change the facing direction of the Enemy.	//To move the Enemy	public void move(Rectangle boundary){		setDirection();		if(isGotDestinationPoint()){			setDestinationPosition();			setDirection();		}		if(direction == UP && yPos - SIZE > boundary.y){			yPos -= SPEED;		}else if(direction == DOWN && yPos + SIZE < boundary.y + boundary.height){			yPos += SPEED;		}else if(direction == LEFT && xPos - SIZE > boundary.x){			xPos -= SPEED;		}else if(direction == RIGHT && xPos + SIZE < boundary.x + boundary.width){			xPos += SPEED;		}	}	// Display the Enemy.  The direction the Enemy is facing	// is indicated by a narrow rectangle.	public void draw(Graphics g) {		// Draw the main body of the Enemy		if(color == GREEN){			g.setColor(Color.GREEN);		}else if(color == RED){			g.setColor(Color.RED);		}		g.fillRect(xPos-SIZE, yPos-SIZE, 2*SIZE, 2*SIZE);		g.setColor(Color.black);		g.drawRect(xPos-SIZE, yPos-SIZE, 2*SIZE, 2*SIZE);		// Calculate the position of the direction indicator		Rectangle directionIndicator;		if (direction == UP) {			directionIndicator = new Rectangle(xPos-SIZE+2, yPos-SIZE+2, 2*SIZE-4, 3);		} else if (direction == DOWN) {			directionIndicator = new Rectangle(xPos-SIZE+2, yPos+SIZE-5, 2*SIZE-4, 3);		} else if (direction == LEFT) {			directionIndicator = new Rectangle(xPos-SIZE+2, yPos-SIZE+2, 3, 2*SIZE-4);		} else {			directionIndicator = new Rectangle(xPos+SIZE-5, yPos-SIZE+2, 3, 2*SIZE-4);		}		// Draw the direction indicator		g.setColor(Color.white);		g.fillRect(directionIndicator.x, directionIndicator.y, directionIndicator.width, directionIndicator.height);		g.setColor(Color.black);		g.drawRect(directionIndicator.x, directionIndicator.y, directionIndicator.width, directionIndicator.height);	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
韩国午夜理伦三级不卡影院| 亚洲精品视频免费观看| 欧美日韩美女一区二区| 欧美主播一区二区三区美女| 成人免费视频播放| 成人sese在线| 99这里只有精品| 91九色最新地址| 91精品福利在线一区二区三区| 欧美色精品天天在线观看视频| 欧美精品乱人伦久久久久久| 欧美日韩国产首页| 日韩免费电影一区| 久久精品人人做人人综合| 久久久噜噜噜久久人人看 | 精品一区免费av| 国产精品一区二区久久不卡| 懂色av中文一区二区三区| 99re视频精品| 欧亚一区二区三区| 日韩精品一区二区三区三区免费| 精品国产亚洲一区二区三区在线观看| 国产亚洲精品aa| 一区二区三区四区高清精品免费观看 | 6080日韩午夜伦伦午夜伦| 精品久久一区二区| 国产精品乱码妇女bbbb| 亚洲一区二区欧美| 狠狠色2019综合网| 色妹子一区二区| 精品免费日韩av| 亚洲卡通欧美制服中文| 青青草国产精品亚洲专区无| av高清不卡在线| 日韩美女在线视频| 亚洲天堂精品在线观看| 老司机免费视频一区二区| 成人黄色a**站在线观看| 欧美日韩国产片| 中文字幕不卡在线观看| 日韩影院免费视频| 成a人片亚洲日本久久| 91精品办公室少妇高潮对白| 日韩三级视频中文字幕| 亚洲色图一区二区三区| 国产一区二区不卡老阿姨| 欧美三级在线视频| 一区二区中文字幕在线| 国产在线播放一区三区四| 欧美美女直播网站| 亚洲日本一区二区三区| 国产精品1024| 精品欧美乱码久久久久久1区2区| 亚洲色图制服诱惑| 成人av在线影院| 精品国产露脸精彩对白| 婷婷夜色潮精品综合在线| 色哦色哦哦色天天综合| 亚洲天天做日日做天天谢日日欢| 国产一二精品视频| 精品人伦一区二区色婷婷| 五月天激情综合| 91麻豆精品国产91久久久久久 | 亚洲va欧美va人人爽午夜| av在线不卡免费看| 国产精品青草综合久久久久99| 久久精品国产亚洲aⅴ| 欧美一区二区性放荡片| 香蕉av福利精品导航| 91国产免费看| 夜夜嗨av一区二区三区网页| 99久久久国产精品免费蜜臀| 国产精品入口麻豆原神| 丁香网亚洲国际| 中文字幕一区二区在线播放| 国产成人免费视频网站高清观看视频| 欧美xxxxxxxx| 国产精品一二三在| 久久美女艺术照精彩视频福利播放 | 欧美变态tickle挠乳网站| 看片的网站亚洲| 久久久亚洲午夜电影| 国产精品一区一区三区| 国产精品丝袜在线| 97精品国产露脸对白| 一区二区三区精密机械公司| 欧美性色欧美a在线播放| 亚洲高清免费一级二级三级| 欧美亚洲一区二区在线| 日产国产高清一区二区三区| 精品国产91亚洲一区二区三区婷婷| 激情欧美一区二区三区在线观看| 国产亚洲一本大道中文在线| 成人福利视频网站| 一区二区三区日韩| 制服.丝袜.亚洲.中文.综合| 国产一区二区精品久久99| 中文字幕在线一区免费| 色94色欧美sute亚洲线路一ni| 亚洲h动漫在线| 久久青草国产手机看片福利盒子 | 精品少妇一区二区| 成人国产视频在线观看| 亚洲国产精品一区二区尤物区| 欧美刺激午夜性久久久久久久| 国产乱码精品一品二品| 一区二区在线观看视频在线观看| 91精品婷婷国产综合久久性色| 国产精品88av| 亚洲成av人片一区二区梦乃| 欧美成人精品3d动漫h| 成人黄色在线网站| 日韩精彩视频在线观看| 国产日韩成人精品| 91麻豆精品国产91久久久久久| 国产精品夜夜爽| 天天操天天干天天综合网| 久久精品免费在线观看| 5月丁香婷婷综合| 91色.com| 国产精品一区二区久激情瑜伽| 亚洲一区二区美女| 国产精品久久久久久久久动漫 | 久久综合资源网| 欧美日韩在线电影| 不卡av在线免费观看| 久久国产视频网| 亚洲综合无码一区二区| 国产精品久久久久国产精品日日| 欧美一区二区三区在线| 成人免费看视频| 久久免费看少妇高潮| 日本韩国视频一区二区| 国产成人av电影在线播放| 免费一级片91| 天堂av在线一区| 亚洲国产aⅴ成人精品无吗| 亚洲丝袜制服诱惑| 国产视频视频一区| www精品美女久久久tv| 欧美xxxxx裸体时装秀| 7777精品伊人久久久大香线蕉完整版 | 日韩精品国产精品| 亚洲成av人在线观看| 亚洲444eee在线观看| 一区二区三区四区不卡在线| 亚洲欧美日韩国产手机在线 | 自拍偷拍欧美激情| 国产色产综合产在线视频| 精品国产99国产精品| 欧美成人性战久久| 欧美大胆人体bbbb| 久久久久久久久伊人| 久久精品网站免费观看| 中文字幕国产一区| 亚洲欧美在线视频观看| 亚洲女厕所小便bbb| 亚洲色图色小说| 亚洲成人av一区二区三区| 天堂成人免费av电影一区| 麻豆久久久久久| 国产成人av一区| jlzzjlzz亚洲女人18| 91久久精品一区二区二区| 精品视频1区2区3区| 日韩一区二区三区在线观看| 欧美精品一区二区三区高清aⅴ | 久久久国产精品不卡| 国产亚洲精品资源在线26u| 国产精品日产欧美久久久久| 中文字幕一区二区在线观看| 亚洲专区一二三| 蜜桃av一区二区| 成人av网站免费| 欧美午夜精品免费| 精品国产乱码久久久久久老虎 | 91性感美女视频| 欧美亚洲高清一区| 日韩免费高清电影| 中文字幕亚洲精品在线观看| 亚洲激情一二三区| 久久国产人妖系列| 97国产一区二区| 日韩欧美卡一卡二| 亚洲伦理在线免费看| 日本伊人午夜精品| 97久久超碰精品国产| 欧美电影免费观看高清完整版在线| 欧美经典一区二区三区| 亚洲福利视频一区二区| 粉嫩aⅴ一区二区三区四区五区| 欧美丝袜第三区| 国产精品色呦呦| 久久精品国产免费| 色欧美日韩亚洲| 国产精品三级视频| 精品在线免费观看| 欧美一区二区人人喊爽| 亚洲视频一二三| 成人国产在线观看|