当前位置: 首页 > news >正文

网站建设的软件是哪个服装定制网站源码

网站建设的软件是哪个,服装定制网站源码,个人免费网站建设教程,今天的新闻 最新消息前言 该项目是基于Java编写的火柴人版王者荣耀#xff0c;代码来自b站up主https://space.bilibili.com/1485853314#xff0c;代码中所需的图片资源在视频链接下#xff0c;请自行获取#xff1a;【【Java项目】不到2小时用Java做出王者荣耀_手把手教你开发游戏 王者_Java…前言 该项目是基于Java编写的火柴人版王者荣耀代码来自b站up主https://space.bilibili.com/1485853314代码中所需的图片资源在视频链接下请自行获取【【Java项目】不到2小时用Java做出王者荣耀_手把手教你开发游戏 王者_Java游戏开发_游戏项目_腾讯游戏_Java教程】 https://www.bilibili.com/video/BV1yX4y1L7E7/?p3share_sourcecopy_webvd_source4611ec45767280678018f593c547e388。 com.sxt包 主类 package com.sxt; import com.sxt.beast.Beast; import java.awt.Component; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.image.ImageObserver; import java.util.ArrayList; import javax.swing.JButton; import javax.swing.JFrame;public class GameFrame extends JFrame {int state 0;private int windowWidth 1400;private int windowHeight 700;private Image offScreenImage null;private Image attack Toolkit.getDefaultToolkit().getImage(img/attack.jpg);private Image gameWin Toolkit.getDefaultToolkit().getImage(img/gameWin.png);private Image gameLose Toolkit.getDefaultToolkit().getImage(img/gameLose.png);Background background new Background(this);Champion player;Champion champion new ChampionHouyi(this, 700, 3800);MinionBlue mb new MinionBlue(this);MinionRed mr new MinionRed(this);Turret turret new Turret(this);public Beast beast new Beast(this);JButton attackButton;public ArrayListGameObject objList new ArrayList();ArrayListGameObject redList new ArrayList();ArrayListGameObject blueList new ArrayList();public ArrayListGameObject removeList new ArrayList();public GameFrame() {}public void launch() {this.setSize(this.windowWidth, this.windowHeight);this.setLocationRelativeTo((Component)null);this.setDefaultCloseOperation(3);this.setResizable(false);this.setTitle(尚学堂王者荣耀);this.setVisible(true);this.addKeyListener(new KeyMonitor());this.objList.add(this.background);this.objList.addAll(this.turret.turretList);this.objList.addAll(this.beast.beastList);this.blueList.add((GameObject)this.turret.turretList.get(0));this.redList.add((GameObject)this.turret.turretList.get(4));this.attackButton new JButton();this.attackButton.setSize(130, 132);this.attackButton.setLocation(1150, 430);this.attackButton.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {GameFrame.this.player.attack(GameFrame.this.redList);}});this.add(this.attackButton);while(true) {if (this.state 1) {this.turret.addTurret();}this.repaint();try {Thread.sleep(17L);} catch (Exception var2) {var2.printStackTrace();}}}public void paint(Graphics g) {if (this.offScreenImage null) {this.offScreenImage this.createImage(5984, 4452);}Graphics gImage this.offScreenImage.getGraphics();int i;if (this.state 0) {for(i 0; i this.champion.championList.size(); i) {Image classical ((Champion)this.champion.championList.get(i)).classical;gImage.drawImage(classical, i * 160, 20, (ImageObserver)null);JButton championButton new JButton();championButton.setSize(150, 150);championButton.setLocation(i * 150, 0);int finalI i;championButton.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {GameFrame.this.state 1;GameFrame.this.player (Champion)GameFrame.this.champion.championList.get(finalI);GameFrame.this.objList.add(GameFrame.this.player);GameFrame.this.player.addButton();}});this.add(championButton);}} else if (this.state 1) {for(i 0; i this.objList.size(); i) {((GameObject)this.objList.get(i)).paintSelf(gImage);}gImage.drawImage(this.attack, this.player.getX() 500, this.player.getY() 100, (ImageObserver)null);this.objList.removeAll(this.removeList);} else if (this.state 2) {gImage.drawImage(this.gameWin, 0, 5, (ImageObserver)null);} else if (this.state 3) {gImage.drawImage(this.gameLose, 0, 5, (ImageObserver)null);}if (this.state ! 1) {g.drawImage(this.offScreenImage, 0, 0, (ImageObserver)null);} else {g.drawImage(this.offScreenImage, -this.player.getX() 700, -this.player.getY() 350, (ImageObserver)null);}this.requestFocus();}public static void main(String[] args) {GameFrame gameFrame new GameFrame();gameFrame.launch();}private class KeyMonitor extends KeyAdapter {private KeyMonitor() {}public void keyPressed(KeyEvent e) {int key e.getKeyCode();GameFrame.this.player.keyPressed(e);}public void keyReleased(KeyEvent e) {int key e.getKeyCode();GameFrame.this.player.keyReleased(e);}} } GameObject 包 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;import com.sxt.beast.Beast; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import java.awt.Toolkit; import java.util.ArrayList; import java.util.Iterator;public abstract class GameObject {private int x;private int y;private Image img;public GameFrame gameFrame;private int spd;private int hp;private int currentHp;private GameObject target;private boolean hasTarget false;private int dis;private int attackCoolDownTime;private boolean attackCoolDown true;private boolean alive true;boolean beControlled false;public GameObject(GameFrame gameFrame) {this.gameFrame gameFrame;}public GameObject(int x, int y, GameFrame gameFrame) {this.x x;this.y y;this.gameFrame gameFrame;}public GameObject() {}public void addHp(Graphics g, int difX, int difY, int width, int height, Color color) {g.setColor(Color.black);g.drawRect(this.getX() - difX, this.getY() - difY, width, height);g.setColor(color);g.fillRect(this.getX() - difX, this.getY() - difY, width * this.getCurrentHp() / this.getHp(), height);}public double getDis(int x1, int y1, int x2, int y2) {return Math.sqrt(Math.pow((double)(x1 - x2), 2.0) Math.pow((double)(y1 - y2), 2.0));}public boolean recIntersectsRec(Rectangle r1, Rectangle r2) {return r1.intersects(r2);}public boolean recIntersectsCir(Rectangle rec, int x, int y, int r) {return this.getDis(x, y, rec.x, rec.y) (double)r || this.getDis(x, y, rec.x, rec.y rec.height) (double)r || this.getDis(x, y, rec.x rec.width, rec.y) (double)r || this.getDis(x, y, rec.x rec.width, rec.y rec.height) (double)r;}public void attack(ArrayListGameObject gameObjList) {if (this.hasTarget) {if (!this.recIntersectsCir(this.target.getRec(), this.getX(), this.getY(), this.getDis())) {this.setHasTarget(false);} else if (!this.target.isAlive()) {this.setHasTarget(false);} else if (this.isAttackCoolDown() this.isAlive()) {Bullet bullet null;if (Turret.class.isAssignableFrom(this.getClass())) {bullet new Bullet(this.gameFrame, this, this.getTarget(), 500, 50);} else if (Minion.class.isAssignableFrom(this.getClass())) {bullet new Bullet(this.gameFrame, this, this.getTarget(), 50, 30);} else if (this instanceof Champion) {bullet new Bullet(this.gameFrame, this, this.getTarget(), 500, 50, img/bullet.gif);}this.gameFrame.objList.add(bullet);(new AttackCD()).start();}} else {Iterator var3 gameObjList.iterator();GameObject obj;while(var3.hasNext()) {obj (GameObject)var3.next();if (this.recIntersectsCir(obj.getRec(), this.getX(), this.getY(), this.getDis())) {this.setTarget(obj);this.setHasTarget(true);break;}}if (!this.hasTarget gameObjList this.gameFrame.blueList) {if (this.recIntersectsCir(this.gameFrame.player.getRec(), this.getX(), this.getY(), this.getDis())) {this.setTarget(this.gameFrame.player);this.setHasTarget(true);}} else {var3 this.gameFrame.beast.beastList.iterator();while(var3.hasNext()) {obj (GameObject)var3.next();if (this.recIntersectsCir(obj.getRec(), this.getX(), this.getY(), this.getDis())) {this.setTarget(obj);this.setHasTarget(true);break;}}}}}public abstract void paintSelf(Graphics var1);public abstract Rectangle getRec();public int getX() {return this.x;}public void setX(int x) {this.x x;}public int getY() {return this.y;}public void setY(int y) {this.y y;}public Image getImg() {return this.img;}public void setImg(String img) {this.img Toolkit.getDefaultToolkit().getImage(img);}public int getSpd() {return this.spd;}public void setSpd(int spd) {this.spd spd;}public int getHp() {return this.hp;}public void setHp(int hp) {this.hp hp;}public int getCurrentHp() {return this.currentHp;}public void setCurrentHp(int currentHp) {if (currentHp this.getHp() Beast.class.isAssignableFrom(this.getClass())) {System.out.println(yes);this.setTarget(this.gameFrame.player);this.setHasTarget(true);}this.currentHp currentHp;}public GameObject getTarget() {return this.target;}public void setTarget(GameObject target) {this.target target;}public boolean isHasTarget() {return this.hasTarget;}public void setHasTarget(boolean hasTarget) {this.hasTarget hasTarget;}public int getDis() {return this.dis;}public void setDis(int dis) {this.dis dis;}public int getAttackCoolDownTime() {return this.attackCoolDownTime;}public void setAttackCoolDownTime(int attackCoolDownTime) {this.attackCoolDownTime attackCoolDownTime;}public boolean isAttackCoolDown() {return this.attackCoolDown;}public void setAttackCoolDown(boolean attackCoolDown) {this.attackCoolDown attackCoolDown;}public boolean isAlive() {return this.alive;}public void setAlive(boolean alive) {this.alive alive;}class AttackCD extends Thread {AttackCD() {}public void run() {GameObject.this.setAttackCoolDown(false);try {Thread.sleep((long)GameObject.this.attackCoolDownTime);} catch (Exception var2) {var2.printStackTrace();}GameObject.this.setAttackCoolDown(true);this.stop();}} } Minion类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;import java.awt.Color; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.image.ImageObserver; import java.util.ArrayList; import java.util.Iterator;public abstract class Minion extends GameObject {private boolean nextMinion true;private boolean nextLine true;private int minionCount 0;private boolean ifFindTarget false;public Minion(GameFrame gameFrame) {super(gameFrame);this.setHp(800);this.setCurrentHp(this.getHp());this.setDis(100);this.setAttackCoolDownTime(2000);}public abstract void move(ArrayListGameObject var1);public boolean hitMinion(int x, int y, ArrayListGameObject objList) {Rectangle r new Rectangle(x - 16, y - 16, 45, 45);Iterator var6 objList.iterator();GameObject obj;do {if (!var6.hasNext()) {return false;}obj (GameObject)var6.next();} while(obj.getClass() ! this.getClass() || obj this || !r.intersects(obj.getRec()));return true;}public void findTarget(ArrayListGameObject objList) {Iterator var3 objList.iterator();while(var3.hasNext()) {GameObject obj (GameObject)var3.next();if (this.recIntersectsCir(obj.getRec(), this.getX(), this.getY(), 200)) {this.setTarget(obj);this.setIfFindTarget(true);}}if (objList this.gameFrame.blueList this.recIntersectsCir(this.gameFrame.player.getRec(), this.getX(), this.getY(), 200)) {this.setTarget(this.gameFrame.player);this.setIfFindTarget(true);}}public void moveToTarget() {double dis this.getDis(this.getX(), this.getY(), this.getTarget().getX(), this.getTarget().getY());int xSpeed (int)((double)(this.getSpd() * (this.getTarget().getX() - this.getX())) / dis);int ySpeed (int)((double)(this.getSpd() * (this.getTarget().getY() - this.getY())) / dis);if (!this.hitMinion(this.getX() xSpeed, this.getY(), this.gameFrame.objList)) {this.setX(this.getX() xSpeed);}if (!this.hitMinion(this.getX(), this.getY() ySpeed, this.gameFrame.objList)) {this.setY(this.getY() ySpeed);}}public void createMinion(GameFrame gameFrame, ArrayListGameObject minionList) {if (this.nextLine) {if (this.nextMinion) {if (minionList this.gameFrame.blueList) {MinionBlue mb new MinionBlue(gameFrame);gameFrame.objList.add(mb);minionList.add(mb);} else {MinionRed mr new MinionRed(gameFrame);gameFrame.objList.add(mr);minionList.add(mr);}this.minionCount;(new NextMinion()).start();}if (this.minionCount 3) {this.minionCount 0;(new NextLine()).start();}}}public void paintSelf(Graphics g) {if (this.getCurrentHp() 0) {this.setAlive(false);this.gameFrame.removeList.add(this);if (this instanceof MinionBlue) {this.gameFrame.blueList.remove(this);} else {this.gameFrame.redList.remove(this);}} else {if (this instanceof MinionBlue) {this.addHp(g, 17, 28, 45, 10, Color.GREEN);} else {this.addHp(g, 17, 28, 45, 10, Color.RED);}g.drawImage(this.getImg(), this.getX() - 16, this.getY() - 16, (ImageObserver)null);if (!this.beControlled) {if (this instanceof MinionBlue) {this.move(this.gameFrame.redList);} else {this.move(this.gameFrame.blueList);}}}}public Rectangle getRec() {return new Rectangle(this.getX() - 16, this.getY() - 16, 45, 45);}public boolean isIfFindTarget() {return this.ifFindTarget;}public void setIfFindTarget(boolean ifFindTarget) {this.ifFindTarget ifFindTarget;}class NextLine extends Thread {NextLine() {}public void run() {Minion.this.nextLine false;try {Thread.sleep(15000L);} catch (Exception var2) {var2.printStackTrace();}Minion.this.nextLine true;this.stop();}}class NextMinion extends Thread {NextMinion() {}public void run() {Minion.this.nextMinion false;try {Thread.sleep(1500L);} catch (Exception var2) {var2.printStackTrace();}Minion.this.nextMinion true;this.stop();}} } MinionBlue类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;import java.util.ArrayList;public class MinionBlue extends Minion {public MinionBlue(GameFrame gameFrame) {super(gameFrame);this.setImg(img/minion/blue.jpg);this.setX(1325);this.setY(3750);}public void move(ArrayListGameObject objList) {if (this.isIfFindTarget()) {if (!this.recIntersectsCir(this.getTarget().getRec(), this.getX(), this.getY(), 200)) {this.setIfFindTarget(false);} else {if (!this.isHasTarget()) {this.moveToTarget();}this.attack(objList);}} else {this.findTarget(objList);if (this.getX() 4425) {this.setSpd(25);if (!this.hitMinion(this.getX() this.getSpd(), this.getY(), this.gameFrame.blueList)) {this.setX(this.getX() this.getSpd());}} else if (this.getX() 5100 this.getX() 4425) {this.setSpd(20);if (!this.hitMinion(this.getX() this.getSpd(), this.getY(), this.gameFrame.blueList)) {this.setX(this.getX() this.getSpd());}if (!this.hitMinion(this.getX(), this.getY() - this.getSpd(), this.gameFrame.blueList)) {this.setY(this.getY() - this.getSpd());}} else if (this.getX() 4900) {this.setSpd(18);if (!this.hitMinion(this.getX(), this.getY() - this.getSpd(), this.gameFrame.blueList)) {this.setY(this.getY() - this.getSpd());}}}} } MinionRed类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;import java.util.ArrayList;public class MinionRed extends Minion {public MinionRed(GameFrame gameFrame) {super(gameFrame);this.setImg(img/minion/red.jpg);this.setX(5050);this.setY(1125);}public void move(ArrayListGameObject objList) {if (this.isIfFindTarget()) {if (!this.recIntersectsCir(this.getTarget().getRec(), this.getX(), this.getY(), 200)) {this.setIfFindTarget(false);} else {if (!this.isHasTarget()) {this.moveToTarget();}this.attack(objList);}} else {this.findTarget(objList);if (this.getY() 3125) {this.setSpd(18);if (!this.hitMinion(this.getX(), this.getY() this.getSpd(), this.gameFrame.redList)) {this.setY(this.getY() this.getSpd());}} else if (this.getY() 3750 this.getY() 3125) {this.setSpd(20);if (!this.hitMinion(this.getX(), this.getY() this.getSpd(), this.gameFrame.redList)) {this.setY(this.getY() this.getSpd());}if (!this.hitMinion(this.getX() - this.getSpd(), this.getY(), this.gameFrame.redList)) {this.setX(this.getX() - this.getSpd());}} else if (this.getY() 3750) {this.setSpd(25);if (!this.hitMinion(this.getX() - this.getSpd(), this.getY(), this.gameFrame.redList)) {this.setX(this.getX() - this.getSpd());}}}} } Turret类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;import java.awt.Color; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.image.ImageObserver; import java.util.ArrayList;public class Turret extends GameObject {ArrayListTurret turretList new ArrayList();public Turret turretBlueOne;public Turret turretBlueTwo;public Turret turretBlueThree;public Turret turretBlueBase;public Turret turretRedOne;public Turret turretRedTwo;public Turret turretRedThree;public Turret turretRedBase;public Turret(GameFrame gameFrame) {super(gameFrame);this.setImg(img/turret.png);this.turretList.add(this.turretBlueOne new TurretBlue(1860, 3790, gameFrame));this.turretList.add(this.turretBlueTwo new TurretBlue(2650, 3820, gameFrame));this.turretList.add(this.turretBlueThree new TurretBlue(3995, 3830, gameFrame));this.turretList.add(this.turretBlueBase new TurretBlue(1130, 3650, gameFrame));this.turretList.add(this.turretRedOne new TurretRed(5100, 3030, gameFrame));this.turretList.add(this.turretRedTwo new TurretRed(5120, 2100, gameFrame));this.turretList.add(this.turretRedThree new TurretRed(5060, 1570, gameFrame));this.turretList.add(this.turretRedBase new TurretRed(4850, 1100, gameFrame));}public Turret(int x, int y, GameFrame gameFrame) {super(x, y, gameFrame);this.setImg(img/turret.png);this.setHp(6000);this.setCurrentHp(this.getHp());this.setAttackCoolDownTime(1000);this.setDis(300);}public void addTurret() {if (!this.gameFrame.turret.turretBlueOne.isAlive() this.gameFrame.turret.turretBlueTwo.isAlive() this.gameFrame.blueList.indexOf(this.gameFrame.turret.turretBlueTwo) -1) {this.gameFrame.blueList.add(this.gameFrame.turret.turretBlueTwo);}if (!this.gameFrame.turret.turretBlueTwo.isAlive() this.gameFrame.turret.turretBlueThree.isAlive() this.gameFrame.blueList.indexOf(this.gameFrame.turret.turretBlueThree) -1) {this.gameFrame.blueList.add(this.gameFrame.turret.turretBlueThree);}if (!this.gameFrame.turret.turretBlueThree.isAlive() this.gameFrame.turret.turretBlueBase.isAlive() this.gameFrame.blueList.indexOf(this.gameFrame.turret.turretBlueBase) -1) {this.gameFrame.blueList.add(this.gameFrame.turret.turretBlueBase);}if (!this.gameFrame.turret.turretBlueBase.isAlive()) {this.gameFrame.state 3;}if (!this.gameFrame.turret.turretRedOne.isAlive() this.gameFrame.turret.turretRedTwo.isAlive() this.gameFrame.redList.indexOf(this.gameFrame.turret.turretRedTwo) -1) {this.gameFrame.redList.add(this.gameFrame.turret.turretRedTwo);}if (!this.gameFrame.turret.turretRedTwo.isAlive() this.gameFrame.turret.turretRedThree.isAlive() this.gameFrame.redList.indexOf(this.gameFrame.turret.turretRedThree) -1) {this.gameFrame.redList.add(this.gameFrame.turret.turretRedThree);}if (!this.gameFrame.turret.turretRedThree.isAlive() this.gameFrame.turret.turretRedBase.isAlive() this.gameFrame.redList.indexOf(this.gameFrame.turret.turretRedBase) -1) {this.gameFrame.redList.add(this.gameFrame.turret.turretRedBase);}if (!this.gameFrame.turret.turretRedBase.isAlive()) {this.gameFrame.state 2;}}public void paintSelf(Graphics g) {if (this.getCurrentHp() 0) {this.setAlive(false);this.gameFrame.removeList.add(this);if (this instanceof TurretBlue) {this.gameFrame.blueList.remove(this);} else {this.gameFrame.redList.remove(this);}} else {if (this instanceof TurretBlue) {this.addHp(g, 50, 130, 100, 20, Color.GREEN);this.attack(this.gameFrame.redList);} else {this.addHp(g, 50, 130, 100, 20, Color.RED);this.attack(this.gameFrame.blueList);}g.drawImage(this.getImg(), this.getX() - 50, this.getY() - 100, (ImageObserver)null);g.drawOval(this.getX() - 300, this.getY() - 300, 600, 600);}}public Rectangle getRec() {return new Rectangle(this.getX() - 50, this.getY() - 100, 100, 180);} } TurretBlue类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;public class TurretBlue extends Turret {public TurretBlue(GameFrame gameFrame) {super(gameFrame);}public TurretBlue(int x, int y, GameFrame gameFrame) {super(x, y, gameFrame);} } TurretRed类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;public class TurretRed extends Turret {public TurretRed(GameFrame gameFrame) {super(gameFrame);}public TurretRed(int x, int y, GameFrame gameFrame) {super(x, y, gameFrame);} } ChampionHouyi类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;import com.sxt.beast.Beast; import java.awt.Color; import java.awt.Graphics; import java.awt.Polygon; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Iterator; import javax.swing.JButton;public class ChampionHouyi extends Champion {boolean ifAbilityThree false;boolean ifAbilityTwo false;MouseMonitor m;MouseMonitorTwo m2;Polygon p;double sin;double cos;GameObject abilityThreeTarget;boolean ifXOutside;boolean ifYOutside;int X_AbilityTwo;int Y_AbilityTwo;public ChampionHouyi(GameFrame gameFrame) {super(gameFrame);this.abilityOne Toolkit.getDefaultToolkit().getImage(img/Houyi/abilityOne.jpg);this.abilityTwo Toolkit.getDefaultToolkit().getImage(img/Houyi/abilityTwo.jpg);this.abilityThree Toolkit.getDefaultToolkit().getImage(img/Houyi/abilityThree.jpg);this.classical Toolkit.getDefaultToolkit().getImage(img/Houyi/Classical.jpg);this.coolDownTimeOne 14000;this.coolDownTimeTwo 10000;this.coolDownTimeThree 28000;}public ChampionHouyi(GameFrame gameFrame, int i, int j) {super(gameFrame, i, j);}public void exit(MouseAdapter ma) {this.gameFrame.removeMouseListener(ma);}public void attack() {if (this.isAttackCoolDown()) {ArrayListGameObject targets new ArrayList();Iterator var3 this.gameFrame.redList.iterator();GameObject beastObj;while(var3.hasNext()) {beastObj (GameObject)var3.next();if (this.recIntersectsCir(beastObj.getRec(), this.getX() - 250, this.getY() - 250, 500)) {targets.add(beastObj);if (targets.size() 3) {break;}}}var3 this.gameFrame.beast.beastList.iterator();while(var3.hasNext()) {beastObj (GameObject)var3.next();if (this.recIntersectsCir(beastObj.getRec(), this.getX() - 250, this.getY() - 250, 500)) {targets.add(beastObj);if (targets.size() 3) {break;}}}for(int i 0; i targets.size(); i) {Bullet bullet;if (i 0) {bullet new Bullet(this.gameFrame, this, (GameObject)targets.get(i), 400, 50, img/bullet.gif);} else {bullet new Bullet(this.gameFrame, this, (GameObject)targets.get(i), 200, 50, img/bullet.gif);}this.gameFrame.objList.add(bullet);}(new AttackCD()).start();}}public void abilityTwoAttack() {Iterator var2 this.gameFrame.objList.iterator();while(true) {GameObject redObj;do {if (!var2.hasNext()) {return;}redObj (GameObject)var2.next();} while(!(redObj instanceof MinionRed) !Beast.class.isAssignableFrom(redObj.getClass()));if (this.recIntersectsCir(redObj.getRec(), this.X_AbilityTwo - 60, this.Y_AbilityTwo - 60, 120)) {redObj.setCurrentHp(redObj.getCurrentHp() - 400);}if (this.recIntersectsCir(redObj.getRec(), this.X_AbilityTwo - 30, this.Y_AbilityTwo - 30, 60)) {redObj.setCurrentHp(redObj.getCurrentHp() - 200);}}}public void abilityThreeMove() {this.p.translate((int)(50.0 * this.cos), -((int)(50.0 * this.sin)));Iterator var2 this.gameFrame.objList.iterator();while(true) {GameObject redObj;do {if (!var2.hasNext()) {int var3;int[] var4;int y;int var6;if (!this.ifXOutside) {var3 (var4 this.p.xpoints).length;for(var6 0; var6 var3; var6) {y var4[var6];if (y 0 || y 5165) {this.ifXOutside true;break;}}}if (!this.ifYOutside) {var3 (var4 this.p.ypoints).length;for(var6 0; var6 var3; var6) {y var4[var6];if (y 0 || y 4085) {this.ifYOutside true;break;}}}return;}redObj (GameObject)var2.next();} while(!(redObj instanceof MinionRed) !Beast.class.isAssignableFrom(redObj.getClass()));if (this.p.intersects(redObj.getRec())) {redObj.setCurrentHp(redObj.getCurrentHp() - 400);this.abilityThreeTarget redObj;(new AbilityControlCD()).start();this.ifAbilityThree false;(new AbilityThreeCD()).start();}}}public void abilityOne() {if (this.coolDownOne) {(new AbilityOneDuration()).start();(new AbilityOneCD()).start();}}public void abilityTwo() {if (this.coolDownTwo) {this.m2 new MouseMonitorTwo();this.gameFrame.addMouseListener(this.m2);this.X_AbilityTwo 0;this.Y_AbilityTwo 0;}}public void abilityThree() {if (this.coolDownThree) {this.m new MouseMonitor();this.p new Polygon();this.gameFrame.addMouseListener(this.m);this.ifAbilityThree true;this.ifXOutside false;this.ifYOutside false;}}public void abilityEffect(Graphics g) {if (this.ifAbilityTwo) {System.out.println(222);g.setColor(Color.RED);g.fillOval(this.X_AbilityTwo - 60, this.Y_AbilityTwo - 60, 120, 120);g.setColor(Color.BLACK);g.fillOval(this.X_AbilityTwo - 30, this.Y_AbilityTwo - 30, 60, 60);this.abilityTwoAttack();this.X_AbilityTwo 0;this.Y_AbilityTwo 0;this.ifAbilityTwo false;(new AbilityTwoCD()).start();}if (this.ifAbilityThree) {System.out.println(333);g.setColor(Color.RED);g.fillPolygon(this.p);this.abilityThreeMove();if (this.ifXOutside || this.ifYOutside) {this.ifAbilityThree false;this.p new Polygon();(new AbilityThreeCD()).start();}}}class AbilityControlCD extends Thread {AbilityControlCD() {}public void run() {ChampionHouyi.this.abilityThreeTarget.beControlled true;try {Thread.sleep(20000L);} catch (Exception var2) {var2.printStackTrace();}ChampionHouyi.this.abilityThreeTarget.beControlled false;this.stop();}}class AbilityOneCD extends Thread {AbilityOneCD() {}public void run() {ChampionHouyi.this.coolDownOne false;try {ChampionHouyi var10000;int one;for(one ChampionHouyi.this.coolDownTimeOne; ChampionHouyi.this.coolDownTimeOne 0; var10000.coolDownTimeOne - 1000) {Thread.sleep(1000L);System.out.println(技能一冷却时间 ChampionHouyi.this.coolDownTimeOne / 1000);var10000 ChampionHouyi.this;}ChampionHouyi.this.coolDownTimeOne one;} catch (Exception var2) {var2.printStackTrace();}ChampionHouyi.this.coolDownOne true;this.stop();}}class AbilityOneDuration extends Thread {AbilityOneDuration() {}public void run() {JButton substitute ChampionHouyi.this.gameFrame.attackButton;ChampionHouyi.this.gameFrame.remove(ChampionHouyi.this.gameFrame.attackButton);JButton button new JButton();button.setSize(130, 132);button.setLocation(1150, 430);button.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {ChampionHouyi.this.attack();}});ChampionHouyi.this.gameFrame.add(button);try {Thread.sleep(5000L);} catch (Exception var4) {var4.printStackTrace();}ChampionHouyi.this.gameFrame.remove(button);ChampionHouyi.this.gameFrame.add(substitute);this.stop();}}class AbilityThreeCD extends Thread {AbilityThreeCD() {}public void run() {ChampionHouyi.this.coolDownThree false;try {for(int three ChampionHouyi.this.coolDownTimeThree; three 0; three - 1000) {Thread.sleep(1000L);System.out.println(三技能冷却时间 three / 1000);}} catch (Exception var2) {var2.printStackTrace();}ChampionHouyi.this.coolDownThree true;this.stop();}}class AbilityTwoCD extends Thread {AbilityTwoCD() {}public void run() {ChampionHouyi.this.coolDownTwo false;try {ChampionHouyi var10000;int two;for(two ChampionHouyi.this.coolDownTimeTwo; ChampionHouyi.this.coolDownTimeTwo 0; var10000.coolDownTimeTwo - 1000) {Thread.sleep(1000L);System.out.println(技能二冷却时间 ChampionHouyi.this.coolDownTimeTwo / 1000);var10000 ChampionHouyi.this;}ChampionHouyi.this.coolDownTimeTwo two;} catch (Exception var2) {var2.printStackTrace();}ChampionHouyi.this.coolDownTwo true;this.stop();}}class AttackCD extends Thread {AttackCD() {}public void run() {ChampionHouyi.this.setAttackCoolDown(false);try {Thread.sleep((long)ChampionHouyi.this.getAttackCoolDownTime());} catch (Exception var2) {var2.printStackTrace();}ChampionHouyi.this.setAttackCoolDown(true);this.stop();}}private class MouseMonitor extends MouseAdapter {private MouseMonitor() {}public void mousePressed(MouseEvent e) {int mouseX e.getX();int mouseY e.getY();int playerX 700;int playerY 350;double dis ChampionHouyi.this.getDis(mouseX, mouseY, playerX, playerY);ChampionHouyi.this.cos (double)(mouseX - playerX) / dis;ChampionHouyi.this.sin (double)(-(mouseY - playerY)) / dis;int difX (int)(60.0 * ChampionHouyi.this.sin);int difY (int)(60.0 * ChampionHouyi.this.cos);ChampionHouyi.this.p.addPoint(ChampionHouyi.this.getX() - difX, ChampionHouyi.this.getY() - difY);ChampionHouyi.this.p.addPoint(ChampionHouyi.this.getX() difX, ChampionHouyi.this.getY() difY);ChampionHouyi.this.p.addPoint(ChampionHouyi.this.getX() difX (int)(20.0 * ChampionHouyi.this.cos), ChampionHouyi.this.getY() difY - (int)(20.0 * ChampionHouyi.this.sin));ChampionHouyi.this.p.addPoint(ChampionHouyi.this.getX() - difX (int)(20.0 * ChampionHouyi.this.cos), ChampionHouyi.this.getY() - difY - (int)(20.0 * ChampionHouyi.this.sin));ChampionHouyi.this.ifAbilityThree true;ChampionHouyi.this.exit(this);}}private class MouseMonitorTwo extends MouseAdapter {private MouseMonitorTwo() {}public void mousePressed(MouseEvent e) {System.out.println(pressed);int mouseX e.getX();int mouseY e.getY();int playerX 700;int playerY 350;double dis ChampionHouyi.this.getDis(mouseX, mouseY, playerX, playerY);if (dis 250.0) {ChampionHouyi.this.X_AbilityTwo e.getX() - playerX ChampionHouyi.this.getX();ChampionHouyi.this.Y_AbilityTwo e.getY() - playerY ChampionHouyi.this.getY();}ChampionHouyi.this.ifAbilityTwo true;ChampionHouyi.this.exit(this);}} } ChampionDaji类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;import com.sxt.beast.Beast; import java.awt.Color; import java.awt.Graphics; import java.awt.Polygon; import java.awt.Toolkit; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Iterator; import java.util.Random;public class ChampionDaji extends Champion {boolean ifAbilityOne false;boolean ifAbilityTwo false;MouseMonitor m;Polygon p;double sin;double cos;ArrayListGameObject attacked;int step 0;GameObject abilityTwoTarget;Bullet abilityTwoBullet;Bullet[] bulletList new Bullet[]{new Bullet(), new Bullet(), new Bullet(), new Bullet(), new Bullet()};public ChampionDaji(GameFrame gameFrame) {super(gameFrame);this.abilityOne Toolkit.getDefaultToolkit().getImage(img/Daji/abilityOne.jpg);this.abilityTwo Toolkit.getDefaultToolkit().getImage(img/Daji/abilityTwo.jpg);this.abilityThree Toolkit.getDefaultToolkit().getImage(img/Daji/abilityThree.jpg);this.classical Toolkit.getDefaultToolkit().getImage(img/Daji/Classical.jpg);this.coolDownTimeOne 6000;this.coolDownTimeTwo 8000;this.coolDownTimeThree 8000;}public void exit() {this.gameFrame.removeMouseListener(this.m);}public void abilityOneMove() {this.p.translate((int)(50.0 * this.cos), -((int)(50.0 * this.sin)));Iterator var2 this.gameFrame.objList.iterator();while(true) {while(var2.hasNext()) {GameObject redObj (GameObject)var2.next();if (redObj instanceof MinionRed this.p.intersects(redObj.getRec()) this.attacked.indexOf(redObj) -1) {redObj.setCurrentHp(redObj.getCurrentHp() - 400);this.attacked.add(redObj);} else if (Beast.class.isAssignableFrom(redObj.getClass()) this.p.intersects(redObj.getRec()) this.attacked.indexOf(redObj) -1) {redObj.setCurrentHp(redObj.getCurrentHp() - 400);this.attacked.add(redObj);}}return;}}public void abilityOne() {if (this.coolDownOne) {this.m new MouseMonitor();this.p new Polygon();this.gameFrame.addMouseListener(this.m);this.attacked new ArrayList();}}public void abilityTwo() {if (this.coolDownTwo) {boolean find false;Iterator var3 this.gameFrame.objList.iterator();label27:while(true) {GameObject redObj;do {if (!var3.hasNext()) {break label27;}redObj (GameObject)var3.next();} while(!(redObj instanceof MinionRed) !Beast.class.isAssignableFrom(redObj.getClass()));if (this.recIntersectsCir(redObj.getRec(), this.getX(), this.getY(), 250) redObj.isAlive()) {this.abilityTwoBullet new Bullet(this.gameFrame, this, redObj, 250, 60, img/Daji/abilityTwoBullet.png);this.gameFrame.objList.add(this.abilityTwoBullet);this.abilityTwoTarget redObj;this.ifAbilityTwo true;find true;break;}}if (find) {(new AbilityTwoCD()).start();find false;}}}public void abilityThree() {if (this.coolDownThree) {ArrayListGameObject targetList new ArrayList();for(int i 0; i this.gameFrame.objList.size(); i) {GameObject target (GameObject)this.gameFrame.objList.get(i);if ((target instanceof MinionRed || Beast.class.isAssignableFrom(target.getClass())) this.recIntersectsCir(target.getRec(), this.getX(), this.getY(), 250) target.isAlive()) {targetList.add(target);}}if (targetList.size() ! 0) {Random random new Random();for(int count 0; count 5; count) {int r random.nextInt(targetList.size());if (!((GameObject)targetList.get(r)).isAlive()) {GameObject substitute (GameObject)targetList.get(r);substitute.setAlive(true);this.bulletList[count] new Bullet(this.gameFrame, this, substitute, 250, 60, img/Daji/abilityTwoBullet.png);} else {this.bulletList[count] new Bullet(this.gameFrame, this, (GameObject)targetList.get(r), 250, 60, img/Daji/abilityTwoBullet.png);}}(new AbilityThreeBulletCD()).start();(new AbilityThreeCD()).start();}}}public void abilityEffect(Graphics g) {if (this.ifAbilityOne) {g.setColor(Color.RED);g.fillPolygon(this.p);this.abilityOneMove();this.step;if (this.step 10) {this.step 0;this.ifAbilityOne false;}}if (this.ifAbilityTwo) {System.out.println(this.abilityTwoTarget.beControlled);if (this.abilityTwoBullet.getRec().intersects(this.abilityTwoTarget.getRec())) {(new AbilityControllCD()).start();this.ifAbilityTwo false;}}}class AbilityControllCD extends Thread {AbilityControllCD() {}public void run() {ChampionDaji.this.abilityTwoTarget.beControlled true;try {Thread.sleep(20000L);} catch (Exception var2) {var2.printStackTrace();}ChampionDaji.this.abilityTwoTarget.beControlled false;this.stop();}}class AbilityOneCD extends Thread {AbilityOneCD() {}public void run() {ChampionDaji.this.coolDownOne false;try {for(int one ChampionDaji.this.coolDownTimeOne; one 0; one - 1000) {Thread.sleep(1000L);System.out.println(一技能冷却时间 one / 1000);}} catch (Exception var2) {var2.printStackTrace();}ChampionDaji.this.coolDownOne true;this.stop();}}class AbilityThreeBulletCD extends Thread {AbilityThreeBulletCD() {}public void run() {try {ChampionDaji.this.gameFrame.objList.add(ChampionDaji.this.bulletList[0]);Thread.sleep(200L);ChampionDaji.this.gameFrame.objList.add(ChampionDaji.this.bulletList[1]);Thread.sleep(200L);ChampionDaji.this.gameFrame.objList.add(ChampionDaji.this.bulletList[2]);Thread.sleep(200L);ChampionDaji.this.gameFrame.objList.add(ChampionDaji.this.bulletList[3]);Thread.sleep(200L);ChampionDaji.this.gameFrame.objList.add(ChampionDaji.this.bulletList[4]);} catch (Exception var2) {var2.printStackTrace();}this.stop();}}class AbilityThreeCD extends Thread {AbilityThreeCD() {}public void run() {ChampionDaji.this.coolDownThree false;try {for(int three ChampionDaji.this.coolDownTimeThree; three 0; three - 1000) {Thread.sleep(1000L);System.out.println(三技能冷却时间 three / 1000);}} catch (Exception var2) {var2.printStackTrace();}ChampionDaji.this.coolDownThree true;this.stop();}}class AbilityTwoCD extends Thread {AbilityTwoCD() {}public void run() {ChampionDaji.this.coolDownTwo false;try {for(int two ChampionDaji.this.coolDownTimeTwo; two 0; two - 1000) {Thread.sleep(1000L);System.out.println(二技能冷却时间 two / 1000);}} catch (Exception var2) {var2.printStackTrace();}ChampionDaji.this.coolDownTwo true;this.stop();}}private class MouseMonitor extends MouseAdapter {private MouseMonitor() {}public void mousePressed(MouseEvent e) {int mouseX e.getX();int mouseY e.getY();int playerX 700;int playerY 350;double dis ChampionDaji.this.getDis(mouseX, mouseY, playerX, playerY);ChampionDaji.this.cos (double)(mouseX - playerX) / dis;ChampionDaji.this.sin (double)(-(mouseY - playerY)) / dis;int difX (int)(60.0 * ChampionDaji.this.sin);int difY (int)(60.0 * ChampionDaji.this.cos);ChampionDaji.this.p.addPoint(ChampionDaji.this.getX() - difX, ChampionDaji.this.getY() - difY);ChampionDaji.this.p.addPoint(ChampionDaji.this.getX() difX, ChampionDaji.this.getY() difY);ChampionDaji.this.p.addPoint(ChampionDaji.this.getX() difX (int)(20.0 * ChampionDaji.this.cos), ChampionDaji.this.getY() difY - (int)(20.0 * ChampionDaji.this.sin));ChampionDaji.this.p.addPoint(ChampionDaji.this.getX() - difX (int)(20.0 * ChampionDaji.this.cos), ChampionDaji.this.getY() - difY - (int)(20.0 * ChampionDaji.this.sin));ChampionDaji.this.exit();(ChampionDaji.this.new AbilityOneCD()).start();ChampionDaji.this.ifAbilityOne true;}} } Champion类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.image.ImageObserver; import java.util.ArrayList; import javax.swing.JButton;public abstract class Champion extends GameObject {public boolean up;public boolean down;public boolean left;public boolean right;static String[] imgs new String[8];int moveCount 1;Image abilityOne;Image abilityTwo;Image abilityThree;Image classical;int coolDownTimeOne;int coolDownTimeTwo;int coolDownTimeThree;boolean coolDownOne true;boolean coolDownTwo true;boolean coolDownThree true;ArrayListChampion championList new ArrayList();static {for(int i 1; i 8; i) {imgs[i] img/move/ i .png;}}public Champion(GameFrame gameFrame, int x, int y) {super(gameFrame);this.setImg(img/stand.png);this.setX(x);this.setY(y);this.setSpd(75);this.setHp(24000);this.setDis(250);this.setAttackCoolDownTime(100);this.setCurrentHp(this.getHp());this.championList.add(new ChampionDaji(gameFrame));this.championList.add(new ChampionHouyi(gameFrame));}public Champion(GameFrame gameFrame) {super(gameFrame);this.setImg(img/stand.png);this.setX(700);this.setY(3800);this.setSpd(75);this.setHp(24000);this.setDis(250);this.setAttackCoolDownTime(100);this.setCurrentHp(this.getHp());}public void keyPressed(KeyEvent e) {int key e.getKeyCode();if (key 68) {this.right true;}if (key 65) {this.left true;}if (key 87) {this.up true;}if (key 83) {this.down true;}}public void keyReleased(KeyEvent e) {int key e.getKeyCode();if (key 68) {this.right false;}if (key 65) {this.left false;}if (key 87) {this.up false;}if (key 83) {this.down false;}}public void move() {if (this.up) {this.setY(this.getY() - this.getSpd());}if (this.down) {this.setY(this.getY() this.getSpd());}if (this.left) {this.setX(this.getX() - this.getSpd());}if (this.right) {this.setX(this.getX() this.getSpd());}if (!this.up !this.down !this.left !this.right) {this.setImg(img/stand.png);} else {this.setImg(imgs[this.moveCount]);this.moveCount;if (this.moveCount 8) {this.moveCount 1;}}}public void addButton() {JButton button1 new JButton();button1.setSize(100, 100);button1.setLocation(1056, 513);button1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {Champion.this.abilityOne();}});JButton button2 new JButton();button2.setSize(100, 100);button2.setLocation(1090, 370);button2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {Champion.this.abilityTwo();}});JButton button3 new JButton();button3.setSize(100, 100);button3.setLocation(1220, 300);button3.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {Champion.this.abilityThree();}});this.gameFrame.add(button1);this.gameFrame.add(button2);this.gameFrame.add(button3);}public abstract void abilityOne();public abstract void abilityTwo();public abstract void abilityThree();public abstract void abilityEffect(Graphics var1);public void paintSelf(Graphics g) {if (this.getCurrentHp() 0) {this.setAlive(false);this.gameFrame.removeList.add(this);} else {this.addHp(g, 30, 80, 80, 20, Color.GREEN);g.drawImage(this.abilityOne, this.getX() 360, this.getY() 180, (ImageObserver)null);g.drawImage(this.abilityTwo, this.getX() 400, this.getY() 40, (ImageObserver)null);g.drawImage(this.abilityThree, this.getX() 520, this.getY() - 30, (ImageObserver)null);g.drawImage(this.getImg(), this.getX() - 33, this.getY() - 50, (ImageObserver)null);this.move();this.abilityEffect(g);}}public Rectangle getRec() {return new Rectangle(this.getX() - 30, this.getY() - 60, 60, 120);} } Bullet类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;import com.sxt.beast.Beast; import java.awt.Color; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.image.ImageObserver;public class Bullet extends GameObject {GameObject attacker;GameObject target;int ad;public Bullet(GameFrame gameFrame, GameObject attacker, GameObject target, int ad, int spd) {super(attacker.getX(), attacker.getY(), gameFrame);this.attacker attacker;this.target target;this.setAd(ad);this.setSpd(spd);}public Bullet(GameFrame gameFrame, GameObject attacker, GameObject target, int ad, int spd, String img) {super(attacker.getX(), attacker.getY(), gameFrame);this.attacker attacker;this.target target;this.setImg(img);this.setAd(ad);this.setSpd(spd);}public Bullet() {}public void move() {if (this.recIntersectsRec(this.getRec(), this.target.getRec())) {if (Beast.class.isAssignableFrom(this.target.getClass())) {this.target.setTarget(this.gameFrame.player);this.target.setHasTarget(true);}this.target.setCurrentHp(this.target.getCurrentHp() - this.getAd());this.gameFrame.removeList.add(this);}double dis this.getDis(this.getX(), this.getY(), this.target.getX(), this.target.getY());int xSpeed (int)((double)(this.getSpd() * (this.target.getX() - this.getX())) / dis);int ySpeed (int)((double)(this.getSpd() * (this.target.getY() - this.getY())) / dis);this.setX(this.getX() xSpeed);this.setY(this.getY() ySpeed);}public void paintSelf(Graphics g) {g.drawImage(this.getImg(), this.getX() - 16, this.getY() - 16, (ImageObserver)null);if (this.getImg() null) {g.setColor(Color.BLACK);g.fillOval(this.getX() - 5, this.getY() - 5, 10, 10);g.drawRect(this.getX() - 5, this.getY() - 5, 10, 10);}this.move();}public Rectangle getRec() {return new Rectangle(this.getX() - 5, this.getY() - 5, 10, 10);}public int getAd() {return this.ad;}public void setAd(int ad) {this.ad ad;} } Background类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt;import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.image.ImageObserver;public class Background extends GameObject {Image bg Toolkit.getDefaultToolkit().getImage(img/Map.jpg);public Background(GameFrame gameFrame) {super(gameFrame);}public void paintSelf(Graphics g) {g.drawImage(this.bg, 0, 0, (ImageObserver)null);}public Rectangle getRec() {return null;} } 野怪包 beast包 Bear类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt.beast;import com.sxt.GameFrame;public class Bear extends Beast {public Bear(int x, int y, GameFrame gameFrame) {super(x, y, gameFrame);this.setImg(img/beast/bear.jpg);this.width 85;this.height 112;this.setDis(65);} } Beast类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt.beast;import com.sxt.Bullet; import com.sxt.GameFrame; import com.sxt.GameObject; import java.awt.Color; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.image.ImageObserver; import java.util.ArrayList;public class Beast extends GameObject {public ArrayListBeast beastList new ArrayList();int width;int height;int initialX;int initialY;public boolean isAggressive false;Beast beast null;public Beast(GameFrame gameFrame) {super(gameFrame);this.beastList.add(new RedBuff(3045, 3170, gameFrame));this.beastList.add(new Bear(2800, 2855, gameFrame));this.beastList.add(new Bird(3570, 3380, gameFrame));this.beastList.add(new Xiyi(4585, 2365, gameFrame));this.beastList.add(new BlueBuff(4025, 2295, gameFrame));this.beastList.add(new Wolf(4235, 1945, gameFrame));}public Beast(int x, int y, GameFrame gameFrame) {super(x, y, gameFrame);this.setHp(1000);this.setCurrentHp(this.getHp());this.setSpd(10);this.setAttackCoolDownTime(2000);this.initialX this.getX();this.initialY this.getY();this.beast this;}public void moveToTarget() {double dis this.getDis(this.getX(), this.getY(), this.getTarget().getX(), this.getTarget().getY());if (dis 500.0) {this.isAggressive false;this.setHasTarget(false);} else {int xSpeed (int)((double)(this.getSpd() * (this.getTarget().getX() - this.getX())) / dis);int ySpeed (int)((double)(this.getSpd() * (this.getTarget().getY() - this.getY())) / dis);this.setX(this.getX() xSpeed);this.setY(this.getY() ySpeed);}}public void moveToInitialLocation() {double dis this.getDis(this.getX(), this.getY(), this.initialX, this.initialY);if (dis (double)this.getSpd()) {this.setX(this.initialX);this.setY(this.initialY);this.isAggressive true;} else {int xSpeed (int)((double)(this.getSpd() * (this.initialX - this.getX())) / dis);int ySpeed (int)((double)(this.getSpd() * (this.initialY - this.getY())) / dis);this.setX(this.getX() xSpeed);this.setY(this.getY() ySpeed);}}public void move() {if (this.isHasTarget() this.isAggressive) {if (!this.recIntersectsCir(this.getTarget().getRec(), this.getX(), this.getY(), this.getDis())) {this.moveToTarget();} else if (this.isAttackCoolDown() this.isAlive()) {Bullet bullet new Bullet(this.gameFrame, this, this.getTarget(), 500, 50, img/bullet.gif);this.gameFrame.objList.add(bullet);(new AttackCD()).start();}} else {this.moveToInitialLocation();if (this.getCurrentHp() this.getHp()) {this.setCurrentHp(this.getCurrentHp() 100);}}}public void paintSelf(Graphics g) {if (this.getCurrentHp() 0) {System.out.println(beast die);this.setAlive(false);this.gameFrame.removeList.add(this);this.gameFrame.beast.beastList.remove(this);(new ReviveCD()).start();} else {this.addHp(g, this.width / 2, 80, this.width, 20, Color.GREEN);g.drawImage(this.getImg(), this.getX() - this.width / 2, this.getY() - this.height / 2, (ImageObserver)null);g.setColor(Color.RED);g.fillOval(this.getX(), this.getY(), 10, 10);g.drawOval(this.getX() - this.getDis(), this.getY() - this.getDis(), 2 * this.getDis(), 2 * this.getDis());this.move();}}public Rectangle getRec() {return new Rectangle(this.getX() - this.width / 2, this.getY() - this.height / 2, this.width, this.height);}class AttackCD extends Thread {AttackCD() {}public void run() {Beast.this.setAttackCoolDown(false);try {Thread.sleep((long)Beast.this.getAttackCoolDownTime());} catch (Exception var2) {var2.printStackTrace();}Beast.this.setAttackCoolDown(true);this.stop();}}class ReviveCD extends Thread {ReviveCD() {}public void run() {try {Thread.sleep(5000L);} catch (Exception var2) {var2.printStackTrace();}Object reviveBeast;if (Beast.this.beast instanceof RedBuff) {reviveBeast new RedBuff(3045, 3170, Beast.this.gameFrame);} else if (Beast.this.beast instanceof Bear) {reviveBeast new Bear(2800, 2855, Beast.this.gameFrame);} else if (Beast.this.beast instanceof Bird) {reviveBeast new Bird(3570, 3380, Beast.this.gameFrame);} else if (Beast.this.beast instanceof Xiyi) {reviveBeast new Xiyi(4585, 2365, Beast.this.gameFrame);} else if (Beast.this.beast instanceof BlueBuff) {reviveBeast new BlueBuff(4025, 2295, Beast.this.gameFrame);} else {reviveBeast new Wolf(4235, 1945, Beast.this.gameFrame);}Beast.this.gameFrame.objList.add((GameObject) reviveBeast);Beast.this.gameFrame.beast.beastList.add((Beast) reviveBeast);}} } Bird类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt.beast;import com.sxt.GameFrame;public class Bird extends Beast {public Bird(int x, int y, GameFrame gameFrame) {super(x, y, gameFrame);this.setImg(img/beast/红隼.jpg);this.width 122;this.height 98;this.setDis(125);} } BlueBuff类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt.beast;import com.sxt.GameFrame;public class BlueBuff extends Beast {public BlueBuff(int x, int y, GameFrame gameFrame) {super(x, y, gameFrame);this.setImg(img/beast/blueBuff.jpg);this.width 142;this.height 176;this.setDis(70);} } RedBuff类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt.beast;import com.sxt.GameFrame;public class RedBuff extends Beast {public RedBuff(int x, int y, GameFrame gameFrame) {super(x, y, gameFrame);this.setImg(img/beast/redBuff.jpg);this.width 103;this.height 150;this.setDis(70);} } Wolf类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt.beast;import com.sxt.GameFrame;public class Wolf extends Beast {public Wolf(int x, int y, GameFrame gameFrame) {super(x, y, gameFrame);this.setImg(img/beast/wolf.jpg);this.width 145;this.height 140;this.setDis(65);} } Xiyi类 // // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) //package com.sxt.beast;import com.sxt.GameFrame;public class Xiyi extends Beast {public Xiyi(int x, int y, GameFrame gameFrame) {super(x, y, gameFrame);this.setImg(img/beast/蜥蜴.jpg);this.width 111;this.height 65;this.setDis(125);} } End
http://wiki.neutronadmin.com/news/40549/

相关文章:

  • 关于网站策划的说法错误的是汕头制作企业网站
  • 重庆双八自助建设网站网站建设的软件叫啥
  • 网站子站怎么建设企业所得税优惠政策最新2023规定公告
  • 网站域名如何备案北京网站建设哪便宜
  • 泛微e8做网站门户微信推广方案范文
  • 网站加载效果怎么做的网页设计尺寸1920
  • 小网站源码移动端网站建设需要注意哪些问题
  • 网站上怎么做动画广告视频在线观看做同城相亲网站
  • 学生怎么制作网站中企动力公司网站价格
  • 鹤壁做网站价格你的网站尚未进行备案
  • 公司网站建设及推广wordpress会员登录界面美化
  • 厦门网站建设培训班深圳 建网站
  • 江苏网站建设开发网站建设需求分析怎么写
  • 网站开发与系统开发用python做音乐网站
  • 策划书模板范文抖音seo排名系统哪个好用
  • 做网站就业要会什么263企业邮箱怎么注册
  • 移动端 pc网站开发开发公司名字起名大全
  • 考试源码网站wordpress岳阳网站界面设计
  • 南通网站建设公司哪家好集团网站建设特色
  • 富阳网站建设报价河北省建设工程信息网招标公告
  • 加强网站制度建设电子商务网站规划与建设的论文
  • 济南网站建设询问臻动传媒百度小程序wordpress
  • 建app网站要多少钱海南网站建设粤icp备
  • 安阳专业网站建设软通动力外包值得去吗
  • 网站出现500wordpress 基于 网店
  • 龙华营销型网站制作哪家好建设工程合同的内容
  • iis管理器添加网站单页网站编辑器
  • 企业展厅设计公司100%正品保障十堰seo优化教程
  • 站长工具下载appdede免费模板教育网站
  • 房地产网站策划书wordpress xml导入