Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9154 for code/branches


Ignore:
Timestamp:
May 4, 2012, 2:51:44 PM (13 years ago)
Author:
mentzerf
Message:
  • Fixed size of oxw stuff.

+ Added tileScale to TowerDefenseCenterpoint to store the scale of the oxw

  • Removed WaypointController debug prints
Location:
code/branches/newlevel2012
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/newlevel2012/data/levels/towerDefense.oxw

    r9149 r9154  
    2525  <Pawn>
    2626    <camerapositions>
    27       <CameraPosition position="0,0,20"/>
     27      <CameraPosition position="0,0,2000"/>
    2828    </camerapositions>
    2929  </Pawn>
     
    4444  <Tower>
    4545    <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" />
    4747    </attached>
    4848  </Tower>
     
    7070        <!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /-->
    7171       
    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>
    7373      <templates>
    7474        <Template link=spaceshipassff />
    7575      </templates>
    7676      <controller>
    77         <WaypointController accuracy=3>
     77        <WaypointController accuracy=40>
    7878          <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" />
    8384          </waypoints>
    8485        </WaypointController>
    8586      </controller>
    86     </SpaceShip-->
     87    </SpaceShip>
    8788   
    8889
     
    9192        name=towerdefensecenter
    9293        width=16
    93         height=16
     94        height=16
     95        tileScale=100
    9496        towerTemplate=towertemplate
    9597        position="0,0,0"
     
    99101                 
    100102                 <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 />
    102104            <!--Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /--> <!-- Only temporary needed to help align the collisionshape -->
    103105                        <!-- 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  
    153153        void TowerDefense::addTower(int x, int y)
    154154        {
    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)
    156162                {
     163                        //Hard coded: TODO: let this depend on the centerpoint's height, width and fieldsize (fieldsize doesn't exist yet)
    157164                        orxout() << "Can not add Tower: x and y should be between 0 and 15" << endl;
    158165                        return;
    159166                }
    160167               
    161                 orxout()<< "Will add tower at (" << x << "," << y << ")" << endl;
     168                orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl;
    162169               
    163170                Tower* newTower = new Tower(this->center_);
     
    166173                this->center_->attach(newTower);
    167174               
    168                 newTower->setPosition(x-8,y-8,0);
     175                newTower->setPosition((x-8) * tileScale, (y-8) * tileScale, 0);
    169176                newTower->setGame(this);
    170177                //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  
    6767
    6868        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);
    7071        XMLPortParam(TowerDefenseCenterpoint, "towerTemplate", setTowerTemplate, getTowerTemplate, xmlelement, mode);
     72               
    7173        //TODO: add XMLPortObject(TowerDefenseCenterpoint, WorldEntity, "waypoints", addWaypoint, getWaypoint,  xmlelement, mode);
    7274        // 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  
    6969                        unsigned int getHeight(void) const
    7070                { 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_; }
    7180               
    7281            /**
     
    8594            unsigned int width_;
    8695            unsigned int height_;
     96                        unsigned int tileScale_;
     97                       
    8798            std::string towerTemplate_;
    8899    };
  • code/branches/newlevel2012/src/orxonox/controllers/WaypointController.cc

    r9144 r9154  
    6565            return;
    6666
    67                 orxout() << "(" << this->waypoints_.size() << ") entity: " << this->getControllableEntity() << endl;
     67//              orxout() << "(" << this->waypoints_.size() << ") entity: " << this->getControllableEntity() << endl;
    6868
    6969        if (this->waypoints_.size() == 0 || !this->getControllableEntity())
    7070            return;
    7171
    72                 printf("3");
     72//              printf("3");
    7373
    7474        if (this->waypoints_[this->currentWaypoint_]->getWorldPosition().squaredDistance(this->getControllableEntity()->getPosition()) <= this->squaredaccuracy_)
    7575            this->currentWaypoint_ = (this->currentWaypoint_ + 1) % this->waypoints_.size();
    7676
    77                 printf("4");
     77//              printf("4");
    7878
    7979        this->moveToPosition(this->waypoints_[this->currentWaypoint_]->getWorldPosition());
Note: See TracChangeset for help on using the changeset viewer.