Index: code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc	(revision 10154)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc	(revision 10166)
@@ -46,6 +46,6 @@
         this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
         this->center_ = 0;
-        /*
-        this->setHUDTemplate("DodgeRaceHUD"); // !!!!!!!!!!!!!!!	change later*/
+
+        this->setHUDTemplate("DodgeRaceHUD");
     }
 
@@ -53,5 +53,5 @@
     {
         bEndGame = false;
-        lives = 3;
+        lives = 1;
         level = 1;
         point = 0;
@@ -59,5 +59,5 @@
         multiplier = 1;
         b_combo = false;
-        counter = 0;
+        counter = 5000;
         pattern = 1;
         lastPosition = 0;
@@ -95,6 +95,8 @@
 			counter = counter + (currentPosition - lastPosition);
 			lastPosition = currentPosition;
-
-			for(int i=0; i< cubeList.size();i++)
+			point = currentPosition;
+			getPlayer()->speed = 830 - (point / 1000);
+
+			for(uint i=0; i < cubeList.size();i++)
 			{
 				if(cubeList.at(i)->getPosition().x < currentPosition-3000)
@@ -108,5 +110,4 @@
 			{
 				counter = 0;
-
 				for(int i = 0; i<6; i++)
 				{
@@ -147,36 +148,9 @@
         return player;
     }
-/*
-    void DodgeRace::spawnEnemy()
-    {
-        if (getPlayer() == NULL)
-            return;
-
-        for (int i = 0; i < (3*log10(static_cast<double>(level)) + 1); i++)
-        {
-            WeakPtr<DodgeRaceEnemy> newPawn;
-            if (rand() % 42/(1 + level*level) == 0)
-            {
-                newPawn = new DodgeRaceEnemyShooter(this->center_->getContext());
-                newPawn->addTemplate("enemyinvadershooter");
-            }
-            else
-            {
-                newPawn = new DodgeRaceEnemy(this->center_->getContext());
-                newPawn->addTemplate("enemyinvader");
-            }
-            newPawn->setPlayer(player);
-            newPawn->level = level;
-            // spawn enemy at random points in front of player.
-            newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200));
-        }
-    }
-*/
+
     void DodgeRace::costLife()
     {
-    	orxout() << "CostLife" << endl;
-    	endGameTimer.setTimer(3.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
-
-        multiplier = 1;
+    	//endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
+    	lives = 0;
     };
 
@@ -193,25 +167,49 @@
     void DodgeRace::start()
     {
-    	orxout() << "start function called." << endl;
+    	orxout() << "start" << endl;
         init();
+		for(uint i=0; i< cubeList.size();i++)
+		{
+			cubeList.at(i)->destroy();
+			cubeList.erase(cubeList.begin()+i);
+
+		}
+        cubeList.clear();
+        // Set variable to temporarily force the player to spawn.
+        this->bForceSpawn_ = false;
+
+        if (this->center_ == NULL)  // abandon mission!
+        {
+            orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl;
+            GSLevel::startMainMenu();
+            return;
+        }
+        // Call start for the parent class.
+        Deathmatch::start();
+    }
+
+	void DodgeRace::playerPreSpawn(PlayerInfo* player)
+	{
+		if(lives <= 0)
+		{
+			this->end();
+		}
+
+		// Reset all the cubes
+		/*
+		orxout() << "prespawn" << endl;
+		init();
 		for(int i=0; i< cubeList.size();i++)
 		{
 			cubeList.at(i)->destroy();
 			cubeList.erase(cubeList.begin()+i);
-
 		}
-        cubeList.clear();
-        // Set variable to temporarily force the player to spawn.
-        this->bForceSpawn_ = true;
-
-        if (this->center_ == NULL)  // abandon mission!
-        {
-            orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl;
-            GSLevel::startMainMenu();
-            return;
-        }
-        // Call start for the parent class.
-        Deathmatch::start();
-    }
+		cubeList.clear();
+        lives = 1;
+        point = 0;
+        lastPosition = 0;
+        */
+	}
+
     void DodgeRace::addPoints(int numPoints)
     {
