摇摆游戏攻略网

关闭导航
首页 > 动作射击 > 游戏攻略4

坦克大战DEMO

整理:yaobaiwang.com 时间:07月04日

[全民飞机大战进阶炽天使和波塞冬对比分析]全民飞机大战雅典娜怎么样:全民飞机大战进阶炽天使和波塞冬哪个好?波塞冬是全民飞机大战推出的新战机,而进阶炽天使是最受到瞩目的新战机。那么进阶炽天使和波塞冬这两个新战机...+阅读

坦克大战DEMO

实现了基本功能。地方坦克寻路做得比较弱智,每个坦克最多能同时发射5发炮弹。敌方有三种兵种,菜单栏没做响应,这个很简单,需要的可以自己加。上传全部代码,仅供学习参考。 package tank。common;abstract public class Bullet implements Runnable, Common {private int x, y;private int speed;private int direction;private boolean alive;protected int power;public Bullet(int x, int y, int speed, int direction) {this。 x = x;this。y = y;this。speed = speed;this。direction = direction;alive = true;}public void die() {alive = false;}public int getPower() {return power;}public int getX() {return x;}public int getY() {return y;}public boolean isAlive() {return alive;}public void run() {while (true) {try {Thread。 sleep(15);} catch (InterruptedException e) {// TODO Auto-generated catch blocke。printStackTrace();}switch (direction) {case UP:y -= speed;break;case DOWN:y += speed;break;case RIGHT:x += speed;break;case LEFT:x -= speed;break;}if (xWIDTH || y >HEIGHT || yshotKey) {shot();}}}}private class AutoMove implements Runnable {Overridepublic void run() {// TODO Auto-generated method stubint moves[] = new int[4];while (isAlive()) {try {Thread。

sleep(110);} catch (InterruptedException e) {// TODO Auto-generated catch blocke。printStackTrace();}for (int i = 0; i= max) {max = moves[i];direction = i;}}move(direction);}}}private double shotKey;private Point heroPosition;private Tank hero;public EnemyTank(int x, int y, Tank hero, int life, int ID) {super(x, y, Color。 cyan);this。lifes = life;this。hero = hero;super。setImageID(ID);}private int judgeHero(int direction) {heroPosition = new Point(hero。 getX() + 9, hero。getY() + 9);int result = 0;int x = this。getX();int y = this。getY();int speed = this。getSpeed();double distance1 = Math。 abs((this。getX() - heroPosition。x)* (this。getX() - heroPosition。x)+ (this。getY() - heroPosition。y)* (this。getY() - heroPosition。 y));switch (direction) {case UP:y -= speed;break;case DOWN:y += speed;break;case RIGHT:x += speed;break;case LEFT:x -= speed;break;}if (getDirection() == direction) {result += 5000;}if (!canMove(x, y)) {result -= Integer。

MAX_VALUE;}double distance2 = Math。abs((x - heroPosition。x) * (x - heroPosition。x)+ (y - heroPosition。y) * (y - heroPosition。 y));if (Math。random() >0。8) {result += Math。random() * 20000;}result += (distance1 - distance2) * 10;return result;}public void setPosition(int x, int y) {super。 x = x;super。y = y;}public void setShotSpeed(double shotSpeed) {this。shotKey = shotSpeed;}public void startFire() {new Thread(new AutoFire())。 start();}public void startMove() {new Thread(new AutoMove())。start();}} package tank。common;import java。awt。Color;import java。 util。ArrayList;import tank。entity。NormalBullet;public abstract class Tank implements Common {protected int x;protected int y;private Color color;private int speed;private int direction;private ArrayListbullets;private ArrayListtanks;private Bullet bullet;private int maxBulletNum;private boolean alive;protected int lifes;ArrayListwalls;private int tankImageID;{speed = 2;direction = UP;alive = true;}public Tank() {this。

x = 0;this。y = 0;color = Color。black;}public Tank(int x, int y, Color color) {this。x = x;this。y = y;this。color = color;maxBulletNum = 5;bullets = new ArrayList();walls = new ArrayList();}protected boolean canMove(int x, int y) {if (xWIDTH - 20 || yHEIGHT - 20) {return false;}if (tanks == null) {return true;}if (tanks。 size() == 1) {return true;}for (int i = 0; i= tempWall。getX() & y >= tempWall。getY()) {if (x= tempWall。getX() & y= tempWall。 getY()) {return tempWall。canBeWalk();}} else if (x= tempWall。getY()) {if ((x + 20) >= tempWall。getX()& y= tempWall。getX()& (y + 20) >= tempWall。 getY()) {return tempWall。canBeWalk();}}}}for (int i = 0; i= tempTank。getX() & y >= tempTank。getY()) {if (x= tempTank。getX() & y= tempTank。 getY()) {return false;}} else if (x= tempTank。getY()) {if ((x + 20) >= tempTank。getX()& y= tempTank。getX()& (y + 20) >= tempTank。

getY()) {return false;}}}}return true;}public void damage(int power) {lifes -= power;if (lifesgetBullet() {return bullets;}public Color getColor() {return color;}public int getDirection() {return direction;}public int getImageID() {return tankImageID;}public int getSpeed() {return speed;}public ArrayListgetWalls() {return this。 walls;}public int getX() {return x;}public int getY() {return y;}public boolean isAlive() {return alive;}public void move(int direction) {setDirection(direction);int x = this。 x;int y = this。y;switch (direction) {case UP:y -= speed;break;case DOWN:y += speed;break;case RIGHT:x += speed;break;case LEFT:x -= speed;break;}if (canMove(x, y)) {this。 x = x;this。y = y;}}...

坦克大战OL有关问题

只要你技术好,洞悉三系坦克的特点,那么不管是哪一系的坦克都会很牛。 M系,攻击高,爆伤高,往往只要开炮就可以置对手于死地,搭配上“冰雪风暴”,你的正前方是无敌的!但是M系坦克皮薄,很容易遭击毁,搭配“夺命导弹”才是上策。 H系,防御高,血量厚,与M系坦克正好相反,战场生存力极强,搭配上独有技能“修复”,几乎是不死之身!但是它攻击力弱,速度也慢,要灵活运用才是。 A系,储能高,能量恢复快,技能弹花样翻新,令对手防不胜防,但是A系坦克不具有M系或H系的特点,所以战场生存力相对较弱,PK一般都用A系,但战役里A系的表现实在令人不敢恭维(除非是蜘蛛侠、哈雷或鬼舞者、火影)。但是A系的技能卡设定要比另两系不同,你知道。 我是玩双线二区的,不知道火影纹章要多少U一个。

抱歉。 希望采纳,^_^~~

以下为关联内容:

全民飞机大战安妮和风暴烈鹰哪个好全民飞机大战宠物小仙子怎么样:个人觉得安妮比较好。1.属性分析说是安妮,其实魔熊才是坐骑,安妮妹纸只是驾驶员而已。安妮满级的生命值、攻击力和攻击速度分别为700、980和240...

全民飞机大战星辰套装满级要多少钱全民飞机大战星辰套装和深渊哪个好:钻石花费: 1、60级附能时,需消耗375钻石;附能完成后,就能升级到65级。 2、65级附能时,需消耗2400钻石;附能完成后,就能升级到75级。 下面,来计算下...

全民飞机大战初号机值得入手吗全民飞机大战剧情模式63关攻略第63关怎么过:全民飞机大战新战机初号机值得买吗? 首先我们先来看下新战机初号机的属性和技能吧。 初号机满级属性: 品质:五月亮 生命值:1400 攻击...

全民飞机大战飞行团晋级奖励全民飞机大战等级钻石奖励怎么算的:这个规则不是这样的,这个晋级不是你的飞行团等级,也不是单纯的段位晋级,游戏里有解释,但是估计看到的人没几个。在[飞行团入口]-[飞行团PK]里...

推荐文章