Index: code/branches/towerdefenseHS14/data/levels/templates/tower.oxt
===================================================================
--- code/branches/towerdefenseHS14/data/levels/templates/tower.oxt	(revision 10141)
+++ code/branches/towerdefenseHS14/data/levels/templates/tower.oxt	(revision 10142)
@@ -1,4 +1,4 @@
 <Template name=tower>
-  <Tower
+  <TowerDefenseTower
 
 
@@ -9,5 +9,5 @@
 
    collisionType     = "dynamic"
-   team = 0
+   team = 2
 
 
@@ -20,8 +20,22 @@
         </WaypointPatrolController>
     </controller>
+    
 
 
     <attached>
         <Model position="0,0,0" scale=45 mesh="Tower.mesh" />
+        
+        <Turret position="0,0,-100" collisionType="dynamic" angularDamping=0.999999 mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=2000 minAttackRadius=30>
+        
+	        <collisionShapes>
+	          	<SphereCollisionShape radius="10"   position = "0,0,0"/>
+	        </collisionShapes>
+	       	<controller>
+          		<TurretController/>
+        	</controller>
+	        <?lua
+	          	include("../includes/weaponSettingsTurret.oxi")
+	        ?>
+      	</Turret>
     </attached>
 
@@ -33,5 +47,5 @@
   include("../includes/towerWeaponSettings.oxi")
 ?>
-  </Tower>
+  </TowerDefenseTower>
 </Template>
 
Index: code/branches/towerdefenseHS14/src/modules/towerdefense/CMakeLists.txt
===================================================================
--- code/branches/towerdefenseHS14/src/modules/towerdefense/CMakeLists.txt	(revision 10141)
+++ code/branches/towerdefenseHS14/src/modules/towerdefense/CMakeLists.txt	(revision 10142)
@@ -1,5 +1,5 @@
 SET_SOURCE_FILES(TOWERDEFENSE_SRC_FILES
   TowerDefense.cc
-  Tower.cc
+  TowerDefenseTower.cc
   TowerTurret.cc
   TowerDefenseCenterpoint.cc
Index: code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc
===================================================================
--- code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc	(revision 10141)
+++ code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc	(revision 10142)
@@ -75,5 +75,5 @@
 
 #include "TowerDefense.h"
-//#include "Tower.h"
+#include "TowerDefenseTower.h"
 #include "TowerTurret.h"
 #include "TowerDefenseCenterpoint.h"
@@ -130,4 +130,23 @@
 
         Deathmatch::start();
+
+// Waypoints: [1,3] [10,3] [10,11] [13,11]
+        for (int i=0; i < 16 ; i++){
+        	for (int j = 0; j< 16 ; j++){
+        		towermatrix[i][j] = false;
+        	}
+        }
+        for (int k=0; k<3; k++)
+        	towermatrix[1][k]=true;
+        for (int l=1; l<11; l++)
+                towermatrix[l][3]=true;
+        for (int m=3; m<12; m++)
+                towermatrix[10][m]=true;
+        for (int n=10; n<14; n++)
+                towermatrix[n][11]=true;
+        for (int o=13; o<16; o++)
+                towermatrix[13][o]=true;
+
+
         credits = 5000;
         life = 20;
@@ -135,14 +154,11 @@
         time=0.0;
 
-/*
-        const int kInitialTowerCount = 3;
+ 	const int kInitialTowerCount = 3;
 
         for (int i = 0; i < kInitialTowerCount; i++)
         {
-        	//{{3,2}, {8,5}, {12,10}}; old coordinates
-            TDCoordinate* coordinate = new TDCoordinate(i,(i*2));
-            addTower(coordinate->x, coordinate->y);
-        }
-*/
+            addTower(i+4,(i+5));
+        }
+
 
 
@@ -221,5 +237,5 @@
 
     void TowerDefense::addTower(int x, int y)
-    {/*
+    {
         const TowerCost towerCost = TDDefaultTowerCost;
 
@@ -230,7 +246,7 @@
         }
 
-        if (this->towerExists(x,y))
-        {
-            orxout() << "tower exists!!" << endl;
+        if (towermatrix [x][y]==true)
+        {
+            orxout() << "not possible to put tower here!!" << endl;
             return;
         }
@@ -252,21 +268,18 @@
         orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl;
 
-        // Add tower to coordinatesStack
-        TDCoordinate newTowerCoordinates;
-        newTowerCoordinates.x=x;
-        newTowerCoordinates.y=y;
-
-
-        addedTowersCoordinates_.push_back(newTowerCoordinates);
-
-        // Reduce credit
+        
+
+       //Reduce credit
         this->stats_->buyTower(towerCost);
 
-        // Create tower
-        TowerTurret* newTower = new TowerTurret(this->center_->getContext());
-        newTower->addTemplate(this->center_->getTowerTemplate());
-
-        newTower->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
-        newTower->setGame(this);*/
+        orxout() << "Credit: " << this->stats_->getCredit() << endl;
+
+  //    Create tower
+        TowerDefenseTower* towernew = new TowerDefenseTower(this->center_->getContext());
+        towernew->addTemplate("tower");
+        towernew->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
+        towernew->setGame(this);
+
+        towermatrix[x][y]=true;
     }
 
@@ -276,17 +289,5 @@
     }
 
-    bool TowerDefense::towerExists(int x, int y)
-    {
-        for(std::vector<TDCoordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it)
-        {
-            TDCoordinate currentCoordinates = (TDCoordinate) (*it);
-            if (currentCoordinates.x == x && currentCoordinates.y == y)
-                return true;
-        }
-
-        return false;
-    }
-
-
+ 
     void TowerDefense::tick(float dt)
     {
Index: code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h
===================================================================
--- code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h	(revision 10141)
+++ code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h	(revision 10142)
@@ -55,5 +55,5 @@
 
         std::vector<TowerDefenseEnemy*> TowerDefenseEnemyvector;
-
+        bool towermatrix[16][16];
         void addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr); 
         virtual void start(); //<! The function is called when the gametype starts
@@ -94,8 +94,4 @@
         bool hasEnoughCreditForTower(TowerCost towerCost);
 
-        bool towerExists(int x, int y);
-
-
-        std::vector<TDCoordinate> addedTowersCoordinates_;
         std::vector<TowerTurret*> towers_;
     };
Index: code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc
===================================================================
--- code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc	(revision 10141)
+++ code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc	(revision 10142)
@@ -48,7 +48,7 @@
         float distance = ship.distance(*endpoint);
 
-        orxout() << "distance" << distance << endl;
+        //orxout() << "distance" << distance << endl;
         if(distance <50){
-        	orxout() << "ENEMY KILLED!!!!" << endl;
+        //	orxout() << "ENEMY KILLED!!!!" << endl;
         	this->destroy(); }
     }
Index: code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.h
===================================================================
--- code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.h	(revision 10141)
+++ code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePlayerStats.h	(revision 10142)
@@ -44,5 +44,5 @@
     typedef enum _TowerCosts {
         // Set to 0 for debug...
-        TDDefaultTowerCost = 0
+        TDDefaultTowerCost = 20
     } TowerCost;
 
Index: code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePrereqs.h
===================================================================
--- code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePrereqs.h	(revision 10141)
+++ code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefensePrereqs.h	(revision 10142)
@@ -66,5 +66,5 @@
 {
     class TowerDefense;
-    //class Tower;
+    class TowerDefenseTower;
     class TowerDefenseCenterpoint;
     class TowerDefenseHUDController;
Index: code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseTower.cc
===================================================================
--- code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseTower.cc	(revision 10142)
+++ code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseTower.cc	(revision 10142)
@@ -0,0 +1,113 @@
+//
+//  TowerDefenseTower.cc
+//  Orxonox
+//
+//  Created by Fabian Mentzer on 29.04.12.
+//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+/* Not implemented fully */
+
+#include "TowerDefenseTower.h"
+
+#include "core/CoreIncludes.h"
+//#include "core/XMLPort.h"
+
+namespace orxonox
+{
+    RegisterClass(TowerDefenseTower);
+
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
+    TowerDefenseTower::TowerDefenseTower(Context* context) : Pawn(context)
+    {
+        RegisterObject(TowerDefenseTower);
+
+        this->setCollisionType(WorldEntity::Dynamic);
+
+        //this->removeAllEngines();
+
+        /*
+        this->size_ = 10.0f;
+        this->delay_ = false;
+        this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
+        */
+    }
+
+    void TowerDefenseTower::setOrientation(const Quaternion& orientation)
+    {
+        static int ori;
+        //orxout() << "orientation " << ++ori << endl;
+    }
+
+    void TowerDefenseTower::rotateYaw(const Vector2& value)
+    {
+        static int yaw;
+        //orxout() << "rotateYaw " << ++yaw << endl;
+    }
+
+    void TowerDefenseTower::rotatePitch(const Vector2& value)
+    {
+        static int pitch;
+        //orxout() << "rotatePitch " << ++pitch << endl;
+    }
+
+    void TowerDefenseTower::rotateRoll(const Vector2& value)
+    {
+        static int roll;
+        //orxout() << "rotateRoll" << ++roll << endl;
+    }
+
+    // This function is called whenever a player presses the up or the down key.
+    // You have to implement what happens when the up or the down key is pressed.
+    // value.x < 0 means: down key is pressed.
+    // I suggest to create a new class which is a controllable entity I will refer to as "TowerDefenseTowerMover". This is the controllable entity that the
+    // player controls in order to move the TowerDefenseTower along the centerpoint and in order to place the TowerDefenseTower at the appropriate position.
+    //
+
+    // The TowerDefenseTower itsself is controlled by a WayPointPatroController at the instance you place it on the centerpoint.
+    //(don't forget to set the team_ parameter such that all TowerDefenseTower are in the same team)
+
+    //How to move a TowerDefenseTower: simply attach the TowerDefenseTower to the TowerDefenseTowerMover
+    //How to place a TowerDefenseTower: detach the TowerDefenseTower from the TowerDefenseTowerMover
+
+    /**
+    @brief
+        Overloaded the function to rotate the stone.
+    @param value
+        A vector whose first component is the angle by which to rotate.
+    */
+    /*
+    void TowerDefenseTower::moveFrontBack(const Vector2& value)
+    {
+        //orxout() << "frontBack.x: " << value.x << endl;
+    }
+    */
+
+    /**
+    @brief
+        Overloaded the function to steer the stone right and left
+    @param value
+        A vector whose first component is the direction in which we want to steer the stone.
+    */
+    /*
+    void TowerDefenseTower::moveRightLeft(const Vector2& value)
+    {
+        //orxout() << "rightLeft.x: " << value.x << endl;
+
+        if(!this->delay_)
+        {
+            const Vector3& position = this->getPosition();
+            Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
+            if(!this->tetris_->isValidMove(this, newPos))
+                return;
+
+            this->setPosition(newPos);
+            this->delay_ = true;
+            this->delayTimer_.startTimer();
+        }
+    }
+    */
+}
Index: code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseTower.h
===================================================================
--- code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseTower.h	(revision 10142)
+++ code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseTower.h	(revision 10142)
@@ -0,0 +1,52 @@
+//
+//  TowerDefenseTower.h
+//  Orxonox
+//
+//  Created by Fabian Mentzer on 29.04.12.
+//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+/**
+@brief
+See TowerDefenseTowerDefenseReadme.txt for Information.
+
+@ingroup TowerDefenseTowerDefense
+*/
+
+
+#ifndef Orxonox_TowerDefenseTower_h
+#define Orxonox_TowerDefenseTower_h
+
+#include "towerdefense/TowerDefensePrereqs.h"
+#include "worldentities/pawns/SpaceShip.h"
+
+
+namespace orxonox
+{
+    class _TowerDefenseExport TowerDefenseTower : public Pawn
+    {
+    public:
+        TowerDefenseTower(Context* context);
+        virtual ~TowerDefenseTower() {};
+
+        // Maybe later override these to move TowerDefenseTowers with cursor keys
+        /*
+        virtual void moveFrontBack(const Vector2& value);
+        virtual void moveRightLeft(const Vector2& value);
+        */
+
+        // Overriding these to stop TowerDefenseTowers from spasing out
+        void setOrientation(const Quaternion& orientation);
+        virtual void rotateYaw(const Vector2& value);
+        virtual void rotatePitch(const Vector2& value);
+        virtual void rotateRoll(const Vector2& value);
+
+        void setGame(TowerDefense* Towerdefense)
+        { assert(Towerdefense); game_ = Towerdefense; }
+    private:
+        TowerDefense* game_;
+    };
+}
+
+
+#endif
