[Orxonox-commit 4467] r9138 - in code/branches/newlevel2012: data/levels src/modules/towerdefense

mentzerf at orxonox.net mentzerf at orxonox.net
Sun Apr 29 12:40:11 CEST 2012


Author: mentzerf
Date: 2012-04-29 12:40:11 +0200 (Sun, 29 Apr 2012)
New Revision: 9138

Modified:
   code/branches/newlevel2012/data/levels/towerDefense.oxw
   code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc
Log:
Fixed the oxw file (some more):
* the playfield now lies in the x,y layer, the camera is at z = 20, as it should be
* the towers are now longer to be able to see if they fit the playfield marks (they do!)
* moved the playfield, so that towers x,y can easily be mapped to the playfield coordinates. e.g. adding a tower at 0,4 results in -8,-4, the corners of the playfield are at 8,8 / -8,-8 / -8,8 / 8,-8
* the centerpoint is marked with a cylinder


Modified: code/branches/newlevel2012/data/levels/towerDefense.oxw
===================================================================
--- code/branches/newlevel2012/data/levels/towerDefense.oxw	2012-04-29 09:17:38 UTC (rev 9137)
+++ code/branches/newlevel2012/data/levels/towerDefense.oxw	2012-04-29 10:40:11 UTC (rev 9138)
@@ -29,7 +29,7 @@
 <Template name=playfieldcameras defaults=0>
   <Pawn>
     <camerapositions>
-      <CameraPosition position="0,0,20" absolute=true />
+      <CameraPosition position="0,0,20"/>
     </camerapositions>
   </Pawn>
 </Template>
@@ -38,16 +38,17 @@
 <Template name=playfield>
   <Pawn camerapositiontemplate=playfieldcameras>
     <attached>
-      <Model position="0,0,0" orientation="1,1,1,1" mesh="crate.mesh" scale3D="1,1,1" /> <!-- the camera is attached to this -->
+      <Model position="0,0,0" mesh="cylinder.mesh" scale3D="1,1,1" /> <!-- the camera is attached to this -->
     </attached>
   </Pawn>
 </Template>
 
+
 <!-- Template for a tower -->
 <Template name=towertemplate>
   <Tower>
     <attached>
-      <Model position="15,0,0" mesh="cube_green.mesh" scale=1 />
+      <Model position="0,0,0" scale3D="0.5,0.5,2" mesh="cube_green.mesh" />
     </attached>
   </Tower>
 </Template>
@@ -65,15 +66,16 @@
   >
 
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
-    <!--SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /-->
     
+    
 	<!-- Spawns the camera, attached to a crate -->
-    <SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=Pawn pawndesign=playfield />
-    
+	<SpawnPoint team=0 position="0,0,0" spawnclass=Pawn pawndesign=playfield />
+
+	
  	<!--SpawnPoint team=1 position="0,0,10" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff  /-->
+ 	<!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /-->
  	
  	
- 	
  	 <!--SpaceShip position="-10,0,20" lookat="0,0,0">
       <templates>
         <Template link=spaceshipassff />
@@ -98,11 +100,21 @@
 	height=16 
 	towerTemplate=towertemplate 
 	position="0,0,0" 
-	direction="1,0,0" 
+	direction="0,0,0" 
 	collistionType=static 
 	mass=100000>
-        <attached>
-            <Model position="0,0,0" orientation="1,1,1,1" mesh="Playfield_ME.mesh" scale3D="1,1,1" />
+		 
+		 <attached>
+		
+			<Model position="-0.5,-0.5,0" mesh="Playfield_ME.mesh" scale=0.8 />
+			
+			<!--Model position="-8,8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
+			<!--Model position="-8,-8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
+			<!--Model position="8,-8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
+			<!--Model position="8,8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
+			
+			<!--Model position="0,0,50" direction="0,0,0"  mesh="rocket.mesh"  scale3D="0.3,0.3,0.3" /-->
+			
         </attached>
     </TowerDefenseCenterpoint>
 

Modified: code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc	2012-04-29 09:17:38 UTC (rev 9137)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc	2012-04-29 10:40:11 UTC (rev 9138)
@@ -62,6 +62,8 @@
 #include "worldentities/pawns/Pawn.h"
 #include "worldentities/pawns/SpaceShip.h"
 
+#include "chat/ChatManager.h"
+
 /* Part of a temporary hack to allow the player to add towers */
 #include "core/command/ConsoleCommand.h"
 
@@ -97,7 +99,20 @@
     void TowerDefense::start()
     {
         Deathmatch::start();
-        orxout()<< "This is a way to display output on the terminal." <<endl;
+		
+        orxout()<< "Adding towers for debug..." <<endl;
+		
+		addTower(0,15);
+		addTower(15,0);
+		
+		for (int i = 0 ; i <= 15; i++)
+		{
+			addTower(i,i);
+		}
+		
+		orxout()<< "Done" <<endl;
+		
+		ChatManager::message("Use the console command addTower x y to add towers");
     }
 	
 	/*
@@ -112,23 +127,22 @@
 	
 	void TowerDefense::addTower(int x, int y)
 	{
-		if (x > 16 || y > 16)
+		if (x > 15 || y > 15 || x < 0 || y < 0)
 		{
-			orxout() << "x and y should be between 1 and 16" << endl;
+			orxout() << "Can not add Tower: x and y should be between 0 and 15" << endl;
 			return;
 		}
 		
-		orxout()<< "Should add tower at (" << x << "," << y << ")" << endl;
+		orxout()<< "Will add tower at (" << x << "," << y << ")" << endl;
 		
 		Tower* newTower = new Tower(this->center_);
 		newTower->addTemplate(this->center_->getTowerTemplate());
 		
 		this->center_->attach(newTower);
 		
-		newTower->setPosition(0,0,0);
+		newTower->setPosition(x-8,y-8,0);
 		newTower->setGame(this);
 		
-		
 		// TODO: create Tower mesh
 		// TODO: load Tower mesh
 	}




More information about the Orxonox-commit mailing list