Index: /code/branches/towerdefenseHS14/data/overlays/towerdefenseHUD.oxo
===================================================================
--- /code/branches/towerdefenseHS14/data/overlays/towerdefenseHUD.oxo	(revision 10158)
+++ /code/branches/towerdefenseHS14/data/overlays/towerdefenseHUD.oxo	(revision 10159)
@@ -37,5 +37,5 @@
      align     = "left"
 
-     caption = "Lives:"
+     caption = "Lifes:"
     />
     
Index: /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc
===================================================================
--- /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc	(revision 10158)
+++ /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc	(revision 10159)
@@ -102,5 +102,5 @@
         this->setHUDTemplate("TowerDefenseHUD");
 
-        this->stats_ = new TowerDefensePlayerStats();
+        //this->stats_ = new TowerDefensePlayerStats();
 
         /* Temporary hack to allow the player to add towers */
@@ -131,8 +131,8 @@
 
         Deathmatch::start();
-        credits = 5000;
+        /*credits = 5000;
         life = 20;
         waves = 0;
-        time=0.0;
+        time=0.0;*/
 
 // Waypoints: [1,3] [10,3] [10,11] [13,11]
@@ -154,7 +154,7 @@
 
 
-        credits = 5000;
-        life = 20;
-        waves = 0;
+        this->setCredit(200);
+        this->setLifes(10);
+        this->setWaveNumber(0);
         time=0.0;
 
@@ -236,14 +236,14 @@
         Deathmatch::end();
 
-        ChatManager::message("Match is over");
+        ChatManager::message("Match is over! Gameover!");
     }
 
     void TowerDefense::upgradeTower(int x,int y)
-    {
-    	const TowerCost upgraeCost = TDDefaultUpgradeCost;
-
-        if (!this->hasEnoughCreditForTower(upgraeCost))
-        {
-            orxout() << "not enough credit: " << (this->stats_->getCredit()) << " available, " << TDDefaultTowerCost << " needed.";
+    {/*
+    	const TowerCost upgradeCost = TDDefaultUpgradeCost;
+
+        if (!this->hasEnoughCreditForTower(upgradeCost))
+        {
+            orxout() << "not enough credit: " << (this->getCredit()) << " available, " << upgradeCost << " needed.";
             return;
         }
@@ -258,5 +258,5 @@
         {
         	(towermatrix [x][y])->upgradeTower();
-        }
+        }*/
     }
 
@@ -264,9 +264,9 @@
     void TowerDefense::addTower(int x, int y)
     {
-        const TowerCost towerCost = TDDefaultTowerCost;
+        const int towerCost = 20;
 
         if (!this->hasEnoughCreditForTower(towerCost))
         {
-            orxout() << "not enough credit: " << (this->stats_->getCredit()) << " available, " << TDDefaultTowerCost << " needed.";
+            orxout() << "not enough credit: " << (this->getCredit()) << " available, " << towerCost << " needed.";
             return;
         }
@@ -278,8 +278,8 @@
         }
 
-
+/*
         unsigned int width = this->center_->getWidth();
         unsigned int height = this->center_->getHeight();
-
+*/
 
         int tileScale = (int) this->center_->getTileScale();
@@ -297,7 +297,8 @@
 
        //Reduce credit
-        this->stats_->buyTower(towerCost);
-
-        orxout() << "Credit: " << this->stats_->getCredit() << endl;
+        this->buyTower(towerCost);
+
+        towermatrix [x][y]=true;
+
 
   //    Create tower
@@ -307,10 +308,9 @@
         towernew->setGame(this);
 
-        towermatrix[x][y]=true;
-    }
-
-    bool TowerDefense::hasEnoughCreditForTower(TowerCost towerCost)
-    {
-        return ((this->stats_->getCredit()) >= towerCost);
+    }
+
+    bool TowerDefense::hasEnoughCreditForTower(int towerCost)
+    {
+        return ((this->getCredit()) >= towerCost);
     }
 
Index: /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h
===================================================================
--- /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h	(revision 10158)
+++ /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h	(revision 10159)
@@ -62,8 +62,16 @@
         //virtual void playerEntered(PlayerInfo* player);
         //virtual bool playerLeft(PlayerInfo* player);
+        //Player Stats (set,get, reduce)
+        int getCredit(){	return this->credit_;	}
+        int getLifes(){		return this->lifes_;	}
+        int getWaveNumber(){	return this->waves_;	}
+        void setCredit(int credit){ credit_ = credit; }
+        void setLifes(int lifes){ lifes_ = lifes; }
+        void setWaveNumber(int wavenumber){waves_=wavenumber;	}
+        void buyTower(int cost){ credit_ -= cost;}
+        void addCredit(int credit) {	credit_+=credit;	}
+        void nextwave(){ waves_++;}
+        int reduceLifes(int NumberofLifes){	return lifes_-=NumberofLifes;	}
 
-        int credits;
-        int life;
-        int waves;
         //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
         //virtual void playerScored(PlayerInfo* player, int score);
@@ -92,8 +100,10 @@
         float time;
         float time2;
+        int credit_;
+        int waves_;
+        int lifes_;
 
         /* handles stats */
-        TowerDefensePlayerStats *stats_;
-        bool hasEnoughCreditForTower(TowerCost towerCost);
+        bool hasEnoughCreditForTower(int towerCost);
         bool hasEnoughCreditForUpgrade();
 
Index: /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc
===================================================================
--- /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc	(revision 10158)
+++ /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc	(revision 10159)
@@ -29,6 +29,10 @@
 
         this->setCollisionType(WorldEntity::Dynamic);
+        this->td = orxonox_cast<TowerDefense*>(this->getGametype().get());
+        once_ = false;
 
     }
+
+    TowerDefenseEnemy::~TowerDefenseEnemy(){this->td->addCredit(20);}
 
     void TowerDefenseEnemy::addWaypoint(TDCoordinate* coord)
@@ -49,7 +53,15 @@
 
         //orxout() << "distance" << distance << endl;
-        if(distance <50){
+        if(distance < 50 && once_ == false){
+        	this->td->reduceLifes(1);
+        	once_=true;
         	orxout() << "ENEMY KILLED!!!!" << endl;
-        	this->destroy(); }
+        	this->td->buyTower(20);
+        	if (this->td->getLifes()==0)
+		{
+		    this->td->end();
+        	}
+
+        }
     }
 
Index: /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.h
===================================================================
--- /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.h	(revision 10158)
+++ /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.h	(revision 10159)
@@ -23,4 +23,5 @@
 #include "util/Output.h"
 #include "controllers/ArtificialController.h"
+#include "TowerDefense.h"
 
 namespace orxonox
@@ -35,5 +36,5 @@
 
 		TowerDefenseEnemy(Context* context);
-        virtual ~TowerDefenseEnemy() {};
+        virtual ~TowerDefenseEnemy();
 
         //health gibt es unter: health_
@@ -47,4 +48,6 @@
 	private:
 
+        TowerDefense* td;
+        bool once_;
         std::vector<TDCoordinate*> Waypointsvector_;
 
Index: /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.cc
===================================================================
--- /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.cc	(revision 10158)
+++ /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.cc	(revision 10159)
@@ -39,4 +39,5 @@
     {
         RegisterObject(TowerDefenseHUDController);
+        this->td = 0;
     }
 
@@ -49,11 +50,14 @@
     {
         SUPER(TowerDefenseHUDController, tick, dt);
+        const std::string& lifes = multi_cast<std::string>(this->td->getLifes());
+        const std::string& credits = multi_cast<std::string>(this->td->getCredit());
+        const std::string& waves = multi_cast<std::string>(this->td->getWaveNumber());
 
         if(showlives == true)
-          this->setCaption(multi_cast<std::string>(this->td->life));
+          this->setCaption(multi_cast<std::string>(lifes));
         else if(showcredits == true)
-          this->setCaption(multi_cast<std::string>(this->td->credits));
+          this->setCaption(multi_cast<std::string>(credits));
         else if(showwaves == true)
-          this->setCaption(multi_cast<std::string>(this->td->waves));
+          this->setCaption(multi_cast<std::string>(waves));
 
 
@@ -74,6 +78,13 @@
             SUPER(TowerDefenseHUDController, changedOwner);
 
-            td = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get());
-
+            if (this->getOwner() && this->getOwner()->getGametype())
+                    {
+                        this->td = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get());
+                    }
+                    else
+                    {
+                        this->td = 0;
+                    }
+                }
             /*if (this->getOwner() != NULL && this->getOwner()->getGametype())
             {
@@ -86,3 +97,2 @@
         }
 
-}
Index: /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.h
===================================================================
--- /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.h	(revision 10158)
+++ /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.h	(revision 10159)
@@ -39,5 +39,5 @@
 
 #include "towerdefense/TowerDefensePrereqs.h"
-
+#include "TowerDefensePlayerStats.h"
 #include "tools/interfaces/Tickable.h"
 #include "overlays/OverlayText.h"
@@ -73,5 +73,4 @@
     private:
         TowerDefense* td;
-
         bool showcredits;
         bool showlives;
Index: /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.cc
===================================================================
--- /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.cc	(revision 10158)
+++ /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.cc	(revision 10159)
@@ -25,5 +25,5 @@
  *      ...
  */
-
+/*
 #include "TowerDefensePlayerStats.h"
 
@@ -31,14 +31,16 @@
 {
     const int kDefaultCredit = 200;
-
+    const int kDefaultLifes=20;
     TowerDefensePlayerStats::TowerDefensePlayerStats()
     {
         this->credit_ = kDefaultCredit;
         this->waveNumber_ = 0;
+        this->lifes_=kDefaultLifes;
     }
-    /*
+
     TowerDefensePlayerStats::~TowerDefensePlayerStats()
     {
     }
-    */
+
 }
+*/
Index: /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.h
===================================================================
--- /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.h	(revision 10158)
+++ /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.h	(revision 10159)
@@ -68,4 +68,10 @@
             { waveNumber_++; }
 
+        inline int getLifes()
+        	{return lifes_;	}
+
+        inline void reduceLifes(int NumberofLifes)
+        {lifes_-=NumberofLifes; }
+
         inline void upgradeTower(int upgradecost)
         	{ credit_ -= upgradecost;}
@@ -77,4 +83,5 @@
         int waveNumber_;
         int upgradecost;
+        int lifes_;
         //int baseHealth_;
     };
Index: /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePrereqs.h
===================================================================
--- /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePrereqs.h	(revision 10158)
+++ /code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePrereqs.h	(revision 10159)
@@ -66,5 +66,7 @@
 {
     class TowerDefense;
+
     class TowerDefenseTower;
+
     class TowerDefenseCenterpoint;
     class TowerDefenseHUDController;
@@ -73,4 +75,5 @@
     class TDCoordinate;
     class TowerTurret;
+    class TowerDefenseTower;
 }
 
