// Tank Battle Demo
// By Greg Murray
// Date: 5/5/96
//

import java.awt.*;
import java.applet.Applet;
import java.applet.AudioClip;
//import tankProducer;
//import tankConsumer;


public class tank extends Applet implements Runnable {

  // Declare varribles/objects
    Point startingPoint, enemyStartingPoint;
   AudioClip launch, texas, boom, lboom;
   boolean letsStart = false;
   private Thread Tank= null;
   private tankMonitor tankmonitor;
   private Point orderMade, turret;
   Thread consumer, producer;
   Image man, TankImage1, TankImage2, ball1, ball2, ball3, weapon, theTank;

//The following function was modified from the pause funciton presented
//in Java in 21 Days page 204 which was written by Laura Lemay 

void pause(int atime){
  try{
  Tank.sleep(atime);
 } catch(InterruptedException e){}
}

public boolean mouseDown(Event e, int x, int y){
  letsStart = true;
  boom.play();
  return true;
}


public void init(){
  this.setBackground(Color.white);
       // load the images/sounds
  texas = getAudioClip(getCodeBase(), "texas.au");
  lboom = getAudioClip(getCodeBase(), "lboom.au");
  texas = getAudioClip(getCodeBase(), "texas.au");
  boom = getAudioClip(getCodeBase(), "boom.au");
  launch = getAudioClip(getCodeBase(), "launch.au");
  TankImage2 = getImage(getCodeBase(), "images/tank2.gif");
  TankImage1 = getImage(getCodeBase(), "images/tank.gif");
  boom = getAudioClip(getCodeBase(), "boom.au");
  ball1 = getImage(getCodeBase(), "images/ball1.gif");
  ball2 = getImage(getCodeBase(), "images/ball3.gif");
  ball3 = getImage(getCodeBase(), "images/ball2.gif");
  man = getImage(getCodeBase(), "images/hick.gif");
  launch.play();
  

}


public void paint(Graphics g){

  if(!letsStart){
    
    Point startPos = new Point(50,15);
    Point startPos2 = new Point(150,15);
    Font f1 = new Font("TimesRoman", Font.PLAIN, 22);
    Font f2 = new Font("TimesRoman", Font.PLAIN, 14);
    g.setFont(f1);
    g.setColor(Color.blue);
    g.drawString("Tank Commander", 100, 100);
    g.setColor(Color.green);
    g.setFont(f2);
    g.drawString("By Greg Murray", 150, 160);
    g.setColor(Color.black);

    // draw tanks

    g.drawImage(TankImage1,startPos.x,startPos.y,this);
    g.drawImage(TankImage2,startPos2.x,startPos2.y,this);

    drawTank(TankImage1, startPos, 180, "red");
    drawTank(TankImage2, startPos2, 135, "blue");

    // draw weapons
    g.drawImage(man,50,250,this);
    g.drawImage(ball3,300,15,this);
    g.drawImage(ball2,300,42,this);
    g.drawImage(ball1,300,66,this);
    g.drawString("Controls", 350,10);
    g.drawString("1 -  Low Power Bomb", 315,25);
    g.drawString("2 -  Medium Power Bomb", 315,50);
    g.drawString("3 -  High Power Bomb", 315,75);
    g.drawString("L -  Launch Bomb", 315,100);
    g.drawString("A -  Rotate Turret ClockWise", 315,125);
    g.drawString("S -  Rotate Turret Counter Clockwise", 315,150);
    g.drawString("     Arrow Keys Control Tank Movement", 315, 175);
    lboom.play();
   }

}
public void clearAround(Point tank1){

      // erase arount the object

      this.getGraphics().clearRect(tank1.x,tank1.y-20, 30, 20);
      this.getGraphics().clearRect(tank1.x-20,tank1.y-20,20,70);
      this.getGraphics().clearRect(tank1.x+30,tank1.y-20, 20,70);
      this.getGraphics().clearRect(tank1.x,tank1. y+30,30,20);


}

public boolean keyDown(Event evt, int key){

  Point tank1;
  int turret;
  tank1 = tankmonitor.getTankPoint();
  int xpos = tank1.x;
  int ypos = tank1.y;
  turret = tankmonitor.getTurret();
  int txpos = turret;
  
  clearAround(tank1);
      
  if ((char)key == 's' || (char)key == 'S') {
       if (txpos == 360) txpos = -45;
       txpos = txpos + 45;
       if (txpos == 360) txpos = 0;
      }

  if ((char)key == 'a' || (char)key == 'A') {
      if (txpos == 0 ) txpos = 360;
      txpos= txpos - 45;
     }

  if ((char)key == 'l' || (char)key == 'L') {
      tankmonitor.handleShot(true);}

  //--Handle the switching of weapons

  if ((char)key == '1' || (char)key == '!') {
      tankmonitor.handleShotType(ball3, 3);}

  if ((char)key == '2' || (char)key == '@') {
      tankmonitor.handleShotType(ball2, 2);}

  if ((char)key == '3' || (char)key == '#') {
      tankmonitor.handleShotType(ball1, 1);}

  if (key == Event.UP){
         theTank = TankImage1;
         if (ypos >= 0) ypos = ypos -1;
        }

  if (key == Event.DOWN){
         theTank = TankImage1;
         if (ypos <= 270) ypos = ypos +1;
        }

  if (key == Event.RIGHT){
         theTank = TankImage2;
         if (xpos <= 570) xpos = xpos +1;
        }

  if (key == Event.LEFT){
        theTank = TankImage2;
        if (xpos >= 0) xpos = xpos -1;
       }
  tank1.x = xpos;
  tank1.y = ypos;
  turret = txpos;
  tankmonitor.handleTurret(turret);
  tankmonitor.handleTankPoint(tank1);
  return true;
}

public void explodeSequence(Point theLocation){

  int counter, temp1, temp2;
  int mx = theLocation.x+15;
  int my = theLocation.y+15;
  Graphics g = getGraphics();
  pause(100);
  boom.play();
  for (counter=0; counter <20; counter++)
         {
          temp1 = (int)(Math.random()*counter*4);
          temp2 = (int)(Math.random()*counter*4);
          g.setColor(Color.red);
          g.fillRect(mx+temp1,my+temp2,counter/3,counter/3);
          pause(50);
	  g.fillRect(mx+temp1,my-temp2,counter/3,counter/3);
          pause(30);
	  g.fillRect(mx-temp1,my+temp2,counter/3,counter/3);
          pause(15); 
	  g.fillRect(mx-temp1,my-temp2,counter/3,counter/3);
         }
  pause(1000);
  g.clearRect(theLocation.x-100,theLocation.y-100,200,200);
}

public void drawTank(Image aTank, Point inPoint, int inTurret, String theColor){

     Image TankImage = aTank;
     Point tank = inPoint;
     int turret;
     Graphics g = getGraphics();
     boolean shotTaken;
     int tpos, shot, shot2;
     turret = inTurret;
     tpos = turret;

     // set color
     if (theColor.equals("black")) g.setColor(Color.black);
     if (theColor.equals("green")) g.setColor(Color.green);
     if (theColor.equals("blue")) g.setColor(Color.blue);
     if (theColor.equals("red")) g.setColor(Color.red);
     if (theColor.equals("white")) g.setColor(Color.white);
           
     g.drawImage(TankImage, tank.x, tank.y, this);
       if (tpos ==0){

         g.drawLine(tank.x+15,tank.y+15,tank.x +15, tank.y- 5);
         int xpts [] = {tank.x+10,tank.x+20, tank.x+25,tank.x+5, tank.x+10};
         int ypts [] = {tank.y+10,tank.y+10, tank.y+20,tank.y+20, tank.y+10};
         int ptnum = xpts.length;
         g.fillPolygon(xpts,ypts,ptnum);
       }

       else if (tpos == 45){
          int xpts [] = {tank.x+15,tank.x+23, tank.x+20,tank.x+5, tank.x+15};
          int ypts [] = {tank.y+10,tank.y+15, tank.y+25,tank.y+15, tank.y+10};
          int ptnum = xpts.length;
          g.fillPolygon(xpts,ypts,ptnum);
          g.drawLine(tank.x+15,tank.y+15,tank.x+30, tank.y);
         } 

       else if (tpos == 90 ){
          g.drawLine(tank.x+15,tank.y+15,tank.x + 35, tank.y +15);  
          int xpts [] = {tank.x+10,tank.x+20, tank.x+20,tank.x+10, tank.x+10};
          int ypts [] = {tank.y+7,tank.y+13, tank.y+22,tank.y+27, tank.y+7};
          int ptnum = xpts.length;
          g.fillPolygon(xpts,ypts,ptnum);
         }

       else if (tpos == 135){
          g.drawLine(tank.x+15,tank.y+15,tank.x + 30, tank.y +30);  
          int xpts [] = {tank.x+5,tank.x+26, tank.x+24,tank.x+15, tank.x+5};
          int ypts [] = {tank.y+20,tank.y+5, tank.y+18 ,tank.y+25, tank.y+20};
          int ptnum = xpts.length;
          g.fillPolygon(xpts,ypts,ptnum);
         }

       else if (tpos == 180){ 
          g.drawLine(tank.x+15, tank.y+15, tank.x+15, tank.y +30);
          int xpts [] = {tank.x+5,tank.x+25, tank.x+20,tank.x+10, tank.x+5};
          int ypts [] = {tank.y+10,tank.y+10, tank.y+20,tank.y+20, tank.y+10};
          int ptnum = xpts.length;
          g.fillPolygon(xpts,ypts,ptnum);
        }

      else if (tpos == 225){

           g.drawLine(tank.x+15,tank.y+15,tank.x, tank.y+30);  
           int xpts [] = {tank.x+9, tank.x+13, tank.x+28, tank.x+15, tank.x+8};
           int ypts [] = {tank.y+15,tank.y+2, tank.y+23,tank.y+22, tank.y+15};
           int ptnum = xpts.length;
           g.fillPolygon(xpts,ypts,ptnum);
          }

       else if (tpos == 270){
           g.drawLine(tank.x+15,tank.y+15,tank.x, tank.y+15);
           int xpts [] = {tank.x+10, tank.x+20, tank.x+20, tank.x+10, tank.x+10};
           int ypts [] = {tank.y+10, tank.y+5, tank.y+25, tank.y+20, tank.y+10};
           int ptnum = xpts.length;
           g.fillPolygon(xpts,ypts,ptnum);
          }

       else if (tpos == 315){
           g.drawLine(tank.x+15,tank.y+15,tank.x, tank.y);  
           int xpts [] = {tank.x+8, tank.x+15, tank.x+27, tank.x+12, tank.x+8};
           int ypts [] = {tank.y+18, tank.y+8, tank.y + 8, tank.y+28, tank.y+18};
           int ptnum = xpts.length;
           g.fillPolygon(xpts,ypts,ptnum);
          }
}

public void ProcessShot(Point inPoint, int turrPos){

   boolean hit = false;
   Point temp = new Point (0,0);
   Point enemy;
   Point tank = inPoint;
   int tpos, shot, shot2;
   tpos = turrPos;
 
   tank = tankmonitor.getTankPoint();
   enemy = tankmonitor.getEnemyPoint();
  
      //-----Begin Firing Sequence---//
      
      
         weapon = tankmonitor.getShotType();
         launch.play();  

         switch (tpos){

              case 90 : {
                         shot = tank.x+50;
                         while (shot <= 615 && !hit){
                              this.getGraphics().clearRect(shot-10 ,tank.y+13,10,10);
                              this.getGraphics().drawImage(weapon,shot,tank.y+13, this);
                              temp = new Point(shot,tank.y+13);
                              hit = tankmonitor.didIHit(temp);
                              shot = shot + 3;
                             }

                         if (hit){
                            lboom.play();
                            tankmonitor.handleEnemyHits
                                 (tankmonitor.getEnemyHits()+1);
                            if (tankmonitor.getEnemyDead())
                                explodeSequence(temp);
                            hit = false;
                           }
                         tankmonitor.handleShot(false);
                         break;
                        }

               case 0 : {
                         shot = tank.y-30;
                         while (shot >= -15 && !hit){
                            this.getGraphics().clearRect(tank.x+14, shot+15,10,10);
                            this.getGraphics().drawImage(weapon,tank.x+14, shot , this);
                            temp = new Point(tank.x+14, shot);
                            hit = tankmonitor.didIHit(temp);
                            shot = shot - 3;
                           }
                         
                         if (hit){
                            lboom.play();
                            tankmonitor.handleEnemyHits
                               (tankmonitor.getEnemyHits()+1);
                            if (tankmonitor.getEnemyDead())
                                explodeSequence(temp);
                            hit = false;
                           }
                         tankmonitor.handleShot(false);
                         break;
                        }
                          
               case 180 : {
                         shot = tank.y+45;
                         while (shot <= 315 && !hit){
                            this.getGraphics().clearRect(tank.x+14, shot-10,10,10);
                            this.getGraphics().drawImage(weapon,tank.x+14, shot , this);
                            temp = new Point(tank.x+14, shot);
                            hit = tankmonitor.didIHit(temp);
                            shot = shot + 3;
                           }
                         if (hit){
                            lboom.play();
                            tankmonitor.handleEnemyHits
                               (tankmonitor.getEnemyHits()+1);
                            if (tankmonitor.getEnemyDead())
                                explodeSequence(temp);
                            hit = false;
                           }

                         tankmonitor.handleShot(false);
                         break;
                        }

               case 270 : {
                           shot = tank.x-20;
                           while (shot >= -15 && !hit){
                             this.getGraphics().clearRect(shot+10, tank.y+11,10,10);
                             this.getGraphics().drawImage(weapon, shot, tank.y+11 , this);
                             temp = new Point(shot,tank.y+13);
                             hit = tankmonitor.didIHit(temp);
                             shot = shot -3;
                            }
                         if (hit){
                            lboom.play();
                            tankmonitor.handleEnemyHits
                               (tankmonitor.getEnemyHits()+1);
                            if (tankmonitor.getEnemyDead())
                                explodeSequence(temp);
                            hit = false;
                           }
                         tankmonitor.handleShot(false);
                         break;
                        }

               case 315 : {
                         shot2 = tank.x-20 ;
                         shot = tank. y-20 ;
                         while (shot >= -15 && !hit){
                            this.getGraphics().clearRect(shot2 + 10, shot +10 ,10,10);
                            this.getGraphics().drawImage(weapon, shot2, shot , this);
                            temp = new Point(shot2, shot);
                            hit = tankmonitor.didIHit(temp);
                            shot = shot -3;
                            shot2 = shot2 -3;
                          }
                         if (hit){
                            lboom.play();
                            tankmonitor.handleEnemyHits
                               (tankmonitor.getEnemyHits()+1);
                            if (tankmonitor.getEnemyDead())
                                explodeSequence(temp);
                            hit = false;
                           }
                         tankmonitor.handleShot(false);
                         break;
                        }

               case 225 : {
                         shot2 = tank.x-22;
                         shot = tank.y+37;
                         while (shot <= 315 && !hit){
                            this.getGraphics().clearRect(shot2 + 10, shot - 10 ,10,10);
                            this.getGraphics().drawImage(weapon,shot2, shot, this);
                            temp = new Point(shot2, shot);
                            hit = tankmonitor.didIHit(temp);
                            shot = shot + 3;
                            shot2 = shot2 - 3;
                           }
                         if (hit){
                            lboom.play();
                            tankmonitor.handleEnemyHits
                               (tankmonitor.getEnemyHits()+1);
                            if (tankmonitor.getEnemyDead())
                                explodeSequence(temp);
                            hit = false;
                           }
                          tankmonitor.handleShot(false);
                         break;
                        }

               case 135 : {
                         shot2 = tank.x+40;
                         shot = tank.y + 40;
                         while (shot <= 315 && !hit){
                            this.getGraphics().clearRect(shot2 - 10, shot -10 ,10,10);
                            this.getGraphics().drawImage(weapon,shot2, shot, this);
                            temp = new Point(shot2, shot);
                            hit = tankmonitor.didIHit(temp);
                            shot = shot + 3;
                            shot2 = shot2 + 3;
                           }
                         if (hit){
                            lboom.play();
                            tankmonitor.handleEnemyHits
                               (tankmonitor.getEnemyHits()+1);
                            if (tankmonitor.getEnemyDead())
                                explodeSequence(temp);
                            hit = false;
                           }
                         tankmonitor.handleShot(false);
                         break;
                        }


               case 45 : {
                         shot2 = tank.x+35;
                         shot = tank.y -10;
                         while (shot >= -15 && !hit){
                            this.getGraphics().clearRect(shot2 - 10, shot + 10 ,10,10);
                            this.getGraphics().drawImage(weapon,shot2, shot, this);
                            temp = new Point(shot2, shot);
                            hit = tankmonitor.didIHit(temp);
                            shot = shot - 3;
                            shot2 = shot2 + 3;
                           }
                         if (hit){
                            lboom.play();
                            tankmonitor.handleEnemyHits
                               (tankmonitor.getEnemyHits()+1);
                            if (tankmonitor.getEnemyDead())
                                explodeSequence(temp);
                            hit = false;
                           }
                         tankmonitor.handleShot(false);
                         break;
                        }
                      } // end switch
}

public void run(){   // Tank

  Point goodGuy;
  Point enemy;

 
  while (letsStart == false){
      this.getGraphics().drawString("Click the Screen to Begin", 225, 225);
      pause (2000);
      this.getGraphics().clearRect(200, 200,300,40);
      pause (500);
     }
  texas.play();
  
  this.getGraphics().clearRect(0,0,600,300);

  while(Tank!=null){
      try{
        drawTank(theTank, tankmonitor.getTankPoint(),
                  tankmonitor.getTurret(), "black");
        if (tankmonitor.getEnemyDead()){
           this.getGraphics().drawString("Great Shot!", 255, 125);
           texas.play();
           pause (2500);
           this.getGraphics().clearRect(200, 100,150,30);
           pause (500);
           int xpos = (int)(Math.random()*570);
           int ypos = (int)(Math.random()*270);
           Point tempPoint = new Point(xpos, ypos);
           tankmonitor.handleEnemyDead(false);
           tankmonitor.handleEnemyPoint(tempPoint);
           tankmonitor.handleKills(tankmonitor.getKills() + 1);
          }
        enemy = tankmonitor.getEnemyPoint();

        if (!tankmonitor.getEnemyDead()){
           enemy = tankmonitor.getEnemyPoint();
           clearAround(enemy);
           this.getGraphics().drawImage(man, enemy.x, enemy.y,this);
          }

        if (tankmonitor.getShot())
            ProcessShot(tankmonitor.getTankPoint(), tankmonitor.getTurret());
       
        goodGuy = tankmonitor.getTankPoint();

        getAppletContext().showStatus("Position " + goodGuy.x
            + "," + goodGuy.y + "  Turret " + tankmonitor.getTurret() +
              "   Enemy " + enemy.x + " , " + enemy.y + "    Kills: "
            + tankmonitor.getKills());
 
       Tank.sleep(10);
      } catch(InterruptedException e) {
             }
  }
}

public void start (){  // start up all the threads when pizzaThread is null

 

  startingPoint = new Point(100,50);
  enemyStartingPoint = new Point(400,200);

  int turret = 0;

  if (Tank==null) {
       tankMonitor p= new tankMonitor();
       tankmonitor = p;
       tankmonitor.handleEnemyPoint(enemyStartingPoint);
       producer = new tankProducer(p);
       Tank = new Thread(this);
       consumer = new tankConsumer(p);

       // start the threads
       
       producer.start();
       //tankmonitor.handleEnemyPoint(enemyStartingPoint);
       tankmonitor.handleTankPoint(startingPoint);
       tankmonitor.handleTurret(turret);
       tankmonitor.handleShotType(ball3, 3);
       Tank.start();
       //consumer.start(); // I may use later
       theTank = TankImage1;
      }
}


public void stop(){

  // shut down all the threads
  Tank.stop();
  Tank = null;
  producer.stop();
  producer = null;
  consumer.stop();
  consumer = null;
}
}// end Tank Class

//*************************************************************************

class tankProducer extends Thread {
  
  private tankMonitor tankmonitor;
  private int number, total;
  Point enemyTankPt, enemy;

public tankProducer(tankMonitor p){

  tankmonitor=p;
}// end constructor


public void  run (){     //Enemy Thread

  
  int decision1, decision2, xpos, ypos;
  int direction = 0;
  
  while(this!=null)  
    {
      try{
           enemy = tankmonitor.getEnemyPoint();
           xpos = enemy.x;
           ypos = enemy.y;

           // lets make the computer move

           decision1 = (int)(Math.random()*2);

           switch (decision1) {

              case 1 : {
                decision2 = (int)(Math.random()*32);
                switch (decision2){
                     case 1:{
                     direction = 0;
                     break;
                    }
                  case 2:{
                     direction = 90;
                     break;
                    }
                  case 3:{
                     direction = 180;
                     break;
                    }
                 case 4:{
                     direction = 270;
                     break;
                    } 
                }// end inner switch
              } // end case 2

           
            
	     case 2:{    // go the same direction

                 switch (direction){
                    case 0: {
                       if(ypos >=1)  ypos--;
                       break;
                      }
                    case 90: {
                       if(xpos <= 575) xpos++;
                       break;
                      }
                    case 180: {
                       if (ypos <= 275) ypos++;
                       break;
                      }
                    case 270: {
                       if (xpos >= 1) xpos--;
                       break;
                      }
                   }// end inner switch
                } // end case 3
             }// end outer switch

           enemyTankPt = new Point(xpos,ypos);
           tankmonitor.handleEnemyPoint(enemyTankPt);
           this.sleep((int)(Math.random()*50));
           
         } catch(InterruptedException e) {
               }
    }  //end while loop   
     
} // end tankProducer run

 
} // end tankProducer class

//************************************************************************

class tankConsumer extends Thread {
  //Constructor
  private tankMonitor tankmonitor;
public tankConsumer (tankMonitor p){
        tankmonitor = p;
       }

public void  run (){
    while(this!=null)  
      {
       try{
            this.sleep(100);
          }   catch(InterruptedException e) {
               }
       } // end while loop
} // end Consumer run 
} // end class Consumer Class

//*************************************************************************

//This is the monitor
//The code was adapted here as a monitor for my two threads

class tankMonitor {

  private Point enemyPos;
  private Point tankPos;
  private int turret, weaponRef;
  private int kills = 0;
  private int playerStrength = 100;
  private int enemyStrength = 100;
  private boolean Shot = false;
  private int enemyHits = 0;
  private boolean enemyDead = false;
  private boolean playerDead = false;
  private Image weapon;


public synchronized boolean didIHit(Point inPoint){
  if ((inPoint.x > enemyPos.x-8 && inPoint.x < enemyPos.x+26)
       &&  (inPoint.y > enemyPos.y-8 && inPoint.y < enemyPos.y+26)){
       if (weaponRef == 1) enemyStrength = enemyStrength - 30;
       if (weaponRef == 2) enemyStrength = enemyStrength - 20;
       if (weaponRef == 3) enemyStrength = enemyStrength - 10;
       if (enemyStrength <=0){
          enemyStrength = 100;
          enemyDead = true;
         }
       return true;
      }
  else return false;
}

  //handle the tank Position
public synchronized void handleTankPoint (Point invalue) {
  tankPos = invalue;
  notify(); 
}

  //retrieve the tank position
public synchronized Point getTankPoint() {
  notify();
  return tankPos;
}

  // manipulate position
public synchronized void handleEnemyPoint (Point invalue) {
  enemyPos = invalue;
  notify(); 
}

  //retrieve the enemy position
public synchronized Point getEnemyPoint() {
  notify();
  return enemyPos;
}


  //retrieve the whether or not a shot has been made
public synchronized boolean getShot() {
  notify();
  return Shot;
}

  //allow manipulation of the total shot
public synchronized void handleShot (boolean invalue) {
  Shot = invalue;
  notify();
}

  //return the turret possition 
public synchronized int getTurret() {
  notify();
  return turret;
}

  //allow the user to manipulate turret: in degrees
public synchronized void handleTurret (int inTurret) {
  turret = inTurret;
  notify();
}
  //return the number of kills 
public synchronized int getKills() {
  notify();
  return kills;
}

  //allow the user to manipulate number of kills
public synchronized void handleKills (int inNumber) {
  kills = inNumber;
  notify();
}




  //allow for getting of shotType 
public synchronized Image getShotType(){
 notify();
 return weapon;
}

  //allow for manipulation of shotType
public synchronized void handleShotType(Image inImage, int inValue){
 weaponRef = inValue;
 weapon = inImage;
}

  //allow for getting of Enemy Hits
public synchronized int getEnemyHits(){
 notify();
 return enemyHits;
}

  //allow for manipulation of shotType
public synchronized void handleEnemyHits(int inValue){
  enemyHits = inValue;
}

  //allow for getting of Enemy Hits
public synchronized boolean getEnemyDead(){
 notify();
 return enemyDead;
}

  //allow for manipulation of shotType
public synchronized void handleEnemyDead(boolean inValue){
 enemyDead = inValue;
}

  //allow for getting of Enemy Hits
public synchronized boolean playerDead(){
 notify();
 return playerDead;
}

  //allow for manipulation of existence of player
public synchronized void handlePlayerDead(boolean inValue){
  playerDead = inValue;
}





}// end tank monitor Class



