Index: code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc	(revision 9207)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc	(revision 9211)
@@ -77,5 +77,4 @@
 #include "Tower.h"
 #include "TowerDefenseCenterpoint.h"
-#include "TowerDefensePlayerStats.h"
 
 #include "worldentities/SpawnPoint.h"
@@ -156,33 +155,26 @@
 	}
 	
-	bool TowerDefense::hasTower(int x, int y)
-	{
-		for(std::vector<coordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it) 
+	void TowerDefense::addTower(int x, int y)
+	{
+		const TowerCost towerCost = TDDefaultTowerCost;
+		
+		if (!this->hasEnoughCreditForTower(towerCost))
 		{
-			coordinate currentCoordinates = (coordinate) (*it);
-			if (currentCoordinates.x == x && currentCoordinates.y == y)
-				return true;
+			orxout() << "not enough credit: " << (this->stats_->getCredit()) << " available, " << TDDefaultTowerCost << " needed.";
+			return;
 		}
 		
-		return false;
-	}
-	
-	void TowerDefense::addTower(int x, int y)
-	{
-		if (this->hasTower(x,y))
+		if (this->towerExists(x,y))
 		{
 			orxout() << "tower exists!!" << endl;
 			return;
-		}
-		
-		coordinate newTowerCoordinates;
-		newTowerCoordinates.x = x; newTowerCoordinates.y = y;
-		addedTowersCoordinates_.push_back(newTowerCoordinates);
-		
+		}		
+		
+		/*
 		unsigned int width = this->center_->getWidth();
 		unsigned int height = this->center_->getHeight();
+		*/
+		
 		int tileScale = (int) this->center_->getTileScale();
-		
-		orxout() << "tile scale = " << tileScale << endl;
 			
 		if (x > 15 || y > 15 || x < 0 || y < 0)
@@ -195,4 +187,12 @@
 		orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl;
 		
+		// Add tower to coordinatesStack
+		Coordinate newTowerCoordinates = {x, y};
+		addedTowersCoordinates_.push_back(newTowerCoordinates);
+		
+		// Reduce credit
+		this->stats_->buyTower(towerCost);
+		
+		// Create tower
 		Tower* newTower = new Tower(this->center_);
 		newTower->addTemplate(this->center_->getTowerTemplate());
@@ -207,4 +207,22 @@
 		// TODO: load Tower mesh
 	}
+	
+	bool TowerDefense::hasEnoughCreditForTower(TowerCost towerCost)
+	{
+		return ((this->stats_->getCredit()) >= towerCost);
+	}
+	
+	bool TowerDefense::towerExists(int x, int y)
+	{
+		for(std::vector<Coordinate>::iterator it = addedTowersCoordinates_.begin(); it != addedTowersCoordinates_.end(); ++it) 
+		{
+			Coordinate currentCoordinates = (Coordinate) (*it);
+			if (currentCoordinates.x == x && currentCoordinates.y == y)
+				return true;
+		}
+		
+		return false;
+	}
+	
 	
 	void TowerDefense::tick(float dt)
Index: code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.h
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.h	(revision 9207)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.h	(revision 9211)
@@ -41,4 +41,6 @@
 #include "gametypes/Deathmatch.h"
 		 
+ #include "TowerDefensePlayerStats.h"
+		 
 namespace orxonox
 {
@@ -81,15 +83,16 @@
 		/* handles stats */
 		TowerDefensePlayerStats *stats_;
+		bool hasEnoughCreditForTower(TowerCost towerCost);
 	
-		bool hasTower(int x, int y);
+		bool towerExists(int x, int y);
 		
 		typedef struct {
 			int x;
 			int y;
-		} coordinate; 
+		} Coordinate; 
 		
 	
 		
-		std::vector<coordinate> addedTowersCoordinates_;
+		std::vector<Coordinate> addedTowersCoordinates_;
 		std::vector<Tower*> towers_;
 		
Index: code/branches/newlevel2012/src/modules/towerdefense/TowerDefensePlayerStats.h
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefensePlayerStats.h	(revision 9207)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefensePlayerStats.h	(revision 9211)
@@ -42,4 +42,8 @@
 namespace orxonox
 {
+	typedef enum _TowerCosts {
+		TDDefaultTowerCost = 200
+	} TowerCost;
+	
     class _TowerDefenseExport TowerDefensePlayerStats
     {
@@ -52,4 +56,7 @@
 		inline void setCredit(int credit)
 			{ credit_ = credit; }
+		
+		inline void buyTower(TowerCost cost)
+			{ credit_ -= cost;}
 		
 		inline int getWaveNumber()
