Changeset 9154
- Timestamp:
- May 4, 2012, 2:51:44 PM (13 years ago)
- Location:
- code/branches/newlevel2012
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/newlevel2012/data/levels/towerDefense.oxw
r9149 r9154 25 25 <Pawn> 26 26 <camerapositions> 27 <CameraPosition position="0,0,20 "/>27 <CameraPosition position="0,0,2000"/> 28 28 </camerapositions> 29 29 </Pawn> … … 44 44 <Tower> 45 45 <attached> 46 <Model position="0,0,0" scale= 0.25 mesh="Tower_ME.mesh" />46 <Model position="0,0,0" scale=2.5 mesh="Tower_ME.mesh" /> 47 47 </attached> 48 48 </Tower> … … 70 70 <!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /--> 71 71 72 < !--SpaceShip position="-10,0,20" lookat="0,0,0" scale=0.3>72 <SpaceShip position="-700,-500, 100" lookat="0,0,0" scale=10> 73 73 <templates> 74 74 <Template link=spaceshipassff /> 75 75 </templates> 76 76 <controller> 77 <WaypointController accuracy= 3>77 <WaypointController accuracy=40> 78 78 <waypoints> 79 <Model mesh="cube.mesh" scale=0.2 position="-8,-8,3" /> 80 <Model mesh="cube.mesh" scale=0.2 position="8,8,3" /> 81 <Model mesh="cube.mesh" scale=0.2 position="8,-8,3" /> 82 <Model mesh="cube.mesh" scale=0.2 position="-8,8,3" /> 79 <!-- 1,3 10,3 10,11, 13,11 --> 80 <Model mesh="cube.mesh" scale=1 position="-700,-500, 100" /> 81 <Model mesh="cube.mesh" scale=1 position=" 200,-500, 100" /> 82 <Model mesh="cube.mesh" scale=1 position=" 200, 300, 100" /> 83 <Model mesh="cube.mesh" scale=1 position=" 500, 300, 100" /> 83 84 </waypoints> 84 85 </WaypointController> 85 86 </controller> 86 </SpaceShip -->87 </SpaceShip> 87 88 88 89 … … 91 92 name=towerdefensecenter 92 93 width=16 93 height=16 94 height=16 95 tileScale=100 94 96 towerTemplate=towertemplate 95 97 position="0,0,0" … … 99 101 100 102 <attached> 101 <Model position="- 0.5,-0.5,0" mesh="Playfield_ME.mesh" scale=0.8/>103 <Model position="-50,-50,0" mesh="Playfield_ME.mesh" scale=80 /> 102 104 <!--Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /--> <!-- Only temporary needed to help align the collisionshape --> 103 105 <!-- This was used to mark the playfield, let's let it be here for now --> -
code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc
r9148 r9154 153 153 void TowerDefense::addTower(int x, int y) 154 154 { 155 if (x > 15 || y > 15 || x < 0 || y < 0)//Hard coded: TODO: let this depend on the centerpoint's height, width and fieldsize (fieldsize doesn't exist yet) 155 unsigned int width = this->center_->getWidth(); 156 unsigned int height = this->center_->getHeight(); 157 int tileScale = (int) this->center_->getTileScale(); 158 159 orxout() << "tile scale = " << tileScale << endl; 160 161 if (x > 15 || y > 15 || x < 0 || y < 0) 156 162 { 163 //Hard coded: TODO: let this depend on the centerpoint's height, width and fieldsize (fieldsize doesn't exist yet) 157 164 orxout() << "Can not add Tower: x and y should be between 0 and 15" << endl; 158 165 return; 159 166 } 160 167 161 orxout() << "Will add tower at (" << x << "," << y<< ")" << endl;168 orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl; 162 169 163 170 Tower* newTower = new Tower(this->center_); … … 166 173 this->center_->attach(newTower); 167 174 168 newTower->setPosition( x-8,y-8,0);175 newTower->setPosition((x-8) * tileScale, (y-8) * tileScale, 0); 169 176 newTower->setGame(this); 170 177 //TODO: Save the Tower in a Vector. I would suggest std::vector< std::vector<Tower*> > towers_ as a protected member variable; -
code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc
r9143 r9154 67 67 68 68 XMLPortParam(TowerDefenseCenterpoint, "width", setWidth, getWidth, xmlelement, mode); 69 XMLPortParam(TowerDefenseCenterpoint, "height", setHeight, setWidth, xmlelement, mode); 69 XMLPortParam(TowerDefenseCenterpoint, "height", setHeight, getHeight, xmlelement, mode); 70 XMLPortParam(TowerDefenseCenterpoint, "tileScale", setTileScale, getTileScale, xmlelement, mode); 70 71 XMLPortParam(TowerDefenseCenterpoint, "towerTemplate", setTowerTemplate, getTowerTemplate, xmlelement, mode); 72 71 73 //TODO: add XMLPortObject(TowerDefenseCenterpoint, WorldEntity, "waypoints", addWaypoint, getWaypoint, xmlelement, mode); 72 74 // This was copied and shightly modified from WaypointController.cc ; there are no getters and setters and no membervariable yet -
code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.h
r9141 r9154 69 69 unsigned int getHeight(void) const 70 70 { return this->height_; } 71 72 /** 73 @brief How to convert to world coordinates, e.g. that 0,15 is not at -8,-8 but at -80,-80 (if scale would be 10) 74 */ 75 void setTileScale(unsigned int tileScale) 76 { this->tileScale_ = tileScale; } 77 78 unsigned int getTileScale(void) const 79 { return this->tileScale_; } 71 80 72 81 /** … … 85 94 unsigned int width_; 86 95 unsigned int height_; 96 unsigned int tileScale_; 97 87 98 std::string towerTemplate_; 88 99 }; -
code/branches/newlevel2012/src/orxonox/controllers/WaypointController.cc
r9144 r9154 65 65 return; 66 66 67 orxout() << "(" << this->waypoints_.size() << ") entity: " << this->getControllableEntity() << endl;67 // orxout() << "(" << this->waypoints_.size() << ") entity: " << this->getControllableEntity() << endl; 68 68 69 69 if (this->waypoints_.size() == 0 || !this->getControllableEntity()) 70 70 return; 71 71 72 printf("3");72 // printf("3"); 73 73 74 74 if (this->waypoints_[this->currentWaypoint_]->getWorldPosition().squaredDistance(this->getControllableEntity()->getPosition()) <= this->squaredaccuracy_) 75 75 this->currentWaypoint_ = (this->currentWaypoint_ + 1) % this->waypoints_.size(); 76 76 77 printf("4");77 // printf("4"); 78 78 79 79 this->moveToPosition(this->waypoints_[this->currentWaypoint_]->getWorldPosition());
Note: See TracChangeset
for help on using the changeset viewer.