Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java Ants vs Bees Game

senormcface
senormcface 


Here's a full description of what has to be done: http://www44.zippyshare.com/v/e7AZW6L1/file.html I also attached the pdf instructions. Attachments Tags Clarifications

Answers

Project: Ants versus Bees

felo
felo 



Find attached running program.
it has four packages
Ant package
Bees package
Core Package
img Package which has bee and ant images that are used to display the graphics part

attached also is a screenshot of the compiling program
Attachments
ANTSVSBEE Running program.png (103 K) Download Preview

AntsvsBees.zip (260 K) Download











































Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview

Preview
Ant who protect the Ant who is in the same place */ public class BodyguardAnt extends Containing {

Preview
/** * Creates a new Fire Ant * Armor: 1, Food: 4, Damage: 3, range: 0 */ public FireAnt(){ super(4,1); damage=new Damaging(3); } /** * Do nothing */ @Override public void action(AntColony colony){ }

Preview
Food: 2, Damage: 0 */ public HarvesterAnt () { super(2,1); } /** * Creates a unit

Preview
0); } /** * Kill a random bee in the same place if she can */ @Override public void action(AntColony colony){ Bee target = getTarget(); if (coolDown == 0 && target !=null){

Preview
An Thrower Ant who only can attack in long distance */ public class LongThrowerAnt extends ThrowerAnt{ /** * Creates a new

Preview
damage; /** * Creates a new Ninja Ant. * Armor: 1, Food: 6, Damage: 1, range : 0 */ public NinjaAnt(){

Preview
damage; /** * Creates a new Queen Ant. * Armor: 1, Food: 6, Damage: 1, range : 3 */ public QueenAnt(){ super(6,1); damage=new Damaging(1); nbQueenAnt+=1; } /** *

Preview
{ super(5,1); watersafe=true; } /** * Creates a new ScubaThrower Ant. (use for the creation of Queen Ant) */ public

Preview
public ShortThrowerAnt(){ super(3,1); } /** * Returns a target for this ant * * @return A bee to target

Preview
Damage: 0, range : 3 */ public SlowThrowerAnt(){ super(4,1); } /** * Slow the Closest Bee for three turn

Preview
ants; import core.AntColony; import core.Bee; /** * An Thrower Ant who can stun bee. * * @author Ma?l */ public class StunThrowerAnt extends ThrowerAnt{

Preview
ants; import core.Ant; import core.AntColony; import core.Bee; import core.Damaging; /** * An ant who throws leaves at bees */ public class ThrowerAnt extends Ant { private Damaging damage; /** * Creates a new Thrower Ant. * Armor: 1,

Preview
4, Damage: 0 */ public WallAnt(){ super(4,4); } /** * do nothing */ @Override

Preview
new Armored Bee. * Armor: 3, Food: 4, Damage: 1 */ public

Preview
} public int length(){ return send.length(); } public void reset(){ send=""; } public String getSend(){ return send; } public void add(Bee bee){ if (bee instanceof NormalBee) send+="1"; else if (bee instanceof ArmoredBee) send+="2"; else if (bee

Preview
Bee. * Armor: 1, Food: 4, Damage: 1 */ public FastBee(){ super(1, 4); } /** * Do 2 action in each

Preview
/** * Creates a new Kamikaze Bee. * Armor: 2, Food: 3, Damage: inf+ */ public KamikazeBee(){ super (2, 3); }

Preview
NormalBee extends Bee{ /** * Creates a new Normal Bee.

Preview
8); setDamage(4); } /** * Can do only one action each two turn */ @Override public void action(AntColony colony){ if (cooldown){ if (isBlocked()) { sting(place.getAnt()); }

Preview
blocker=true; } public Ant (int foodCost,int armor){ super(armor, null); this.foodCost =foodCost; blocker=true; } /** * Returns the ant's food cost * * @return the ant's good cost */ public int getFoodCost () { return foodCost; } /** *

Preview
* @param tunnelLength * The length of each tunnel * @param moatFrequency * The frequency of which moats (water areas) appear. 0 means that there are no moats * @param startingFood * The starting food for this colony. */ public AntColony (int numTunnels, int tunnelLength, int moatFrequency, int startingFood) {

Preview
distance between divided by num frames dy = (ny - y) / framesLeft; } @Override public String toString () { return "AnimPosition[x=" + x + ",y=" + y + ",dx=" + dx + ",dy=" + dy + ",framesLeft=" + framesLeft + "]"; } } /** * A utility class for

Preview
if (multigame){ int role=Startmenu.multiplayer(); if (role==0) player = new Player(); else { String[] answer=Startmenu.client(); player = new Player(answer[0],answer[1]);}} new AntGame(colony, hive,player,multigame);}// launch

Preview
} /** * Deals damage to the given ant * * @param ant * The ant to sting */ public void sting (Ant ant) { ant.reduceArmor(DAMAGE); } /** * Moves to the given place * * @param place * The place to move to */ public void moveTo (Place place)

Preview
ant; public Containing(int armor){ super(armor); } public Containing(int food,int armor){ super(food,armor); } public void addAnt (Ant ant) { if (!(ant instanceof Containing))

Preview
Damaging { public int baseDamage;

Preview
@param numBees * The number of bees to attack */ public void addWave (int attackTime, int numBees) { Bee[] bees = new Bee[numBees]; if (numBees==0) return; for (int i = 0; i < bees.length; i++) { bees[i] = new NormalBee(); this.addInsect(bees[i]); // put the bee in Place } waves.put(attackTime, bees);

Preview
public Place getPlace () { return place; } /** * Returns the insect's current armor * * @return the insect's current armor */ public int getArmor () { return armor; } public boolean getWatersafe(){ return watersafe; } public int getTimeStun() { return timeStun; } public void setTimeStun(int timeStun)

Preview
void removeInsect (Ant ant) { if (this.ant instanceof Containing){ if (this.ant ==ant){ Ant temp =((Containing) this.ant).getAnt(); this.ant=temp; this.ant.setPlace(this); } else if (((Containing) this.ant).getAnt()==ant) ((Containing) this.ant).removeAnt(ant); } else if (this.ant == ant && !(this.ant instanceof QueenAnt)) { this.ant = null; ant.setPlace(null); } else if (this.ant instanceof QueenAnt) System.out.println("QueenAnt can't be deleted");

Preview
public Player(String ip,String port){ isServer=false; try{ socket = new DatagramSocket(); byte[] buffer1="patate".getBytes(); envoi = new DatagramPacket(buffer1, buffer1.length,InetAddress.getByName(ip),Integer.parseInt(port)); reception = new DatagramPacket(buffer, buffer.length); socket.send(envoi); System.out.println("Request send"); socket.receive(reception); System.out.println("Request answered"); otherIp=reception.getAddress(); otherPort=reception.getPort();} catch (IOExcept

Preview
this.queenPlace=queenPlace; } @Override public Bee[] getBees(){ ArrayList<Bee> allBees =new ArrayList<Bee>(); for (Bee b:this.getBees()) allBees.add(b);

Preview
public Selector(){ } public static void antSelector(Point panel,ArrayList<String> IN_TYPES){ Point pos = panel; //Point pos = new Point(PANEL_POS); // starting point of the panel int width = AntGame.ANT_IMAGE_SIZE.width + 2 * AntGame.PANEL_PADDING.width; int height = AntGame.ANT_IMAGE_SIZE.height + 2 * AntGame.PANEL_PADDING.height; AntGame.removerArea = new Rectangle(pos.x, pos.y, width,

Preview
javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; public class Startmenu{ public static boolean start() { String[] type = {"Single", "Multiplayer"}; int multiplayer = JOptionPane.showOptionDialog(null, "Choose a type of

Preview
Water extends Place{

Screenshots
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Screenshot
Purchase Answer

Mr.

felo
felo 



1 Attachments
Screenshots
Purchase Answer