Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2012, 10:07:43 PM (13 years ago)
Author:
landauf
Message:

tower defense update (again, now hopefully successful)

Location:
code/branches/presentation2012
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2012

  • code/branches/presentation2012/data/levels/includes/towerWeaponSettings.oxi

    r9229 r9245  
    2020        <Weapon>
    2121          <attached>
    22             <Model mesh="LightningGun.mesh" pitch="100" roll="90" yaw="90" position="0,-1.3,0" scale=20/>
    23             <Model mesh="LightningGun-s.mesh" pitch="78" roll="90" yaw="90" position="0.2,-1.3,0" scale=20 />
    24             <Model mesh="hs-w01_reduced.mesh" roll="45" pitch="-76" yaw="-45" position="-1.5,1,200" scale=20 />
     22            <Model mesh="LightningGun.mesh" pitch="100" roll="90" yaw="90" position="0,-1.3,200" scale=1/>
     23            <Model mesh="LightningGun-s.mesh" pitch="78" roll="90" yaw="90" position="0.2,-1.3,200" scale=1 />
     24            <Model mesh="hs-w01_reduced.mesh" roll="45" pitch="-76" yaw="-45" position="-1.5,1,200" scale=10 />
    2525          </attached>
    2626          <HsW01 mode=0 munitionpershot=0 delay=0.005 damage=31.4159 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" />
  • code/branches/presentation2012/data/levels/templates/tower.oxt

    r9229 r9245  
    55   explosionchunks        = 6
    66
    7    reloadrate          = 1
     7   reloadrate          = 3
    88   reloadwaittime      = 1
    99
     
    1313
    1414  >
    15 
    16    
    17 
    18   <controller>
    19         <WaypointPatrolController alertnessradius=10000 team=5>
    20                  <waypoints>
    21             <Model mesh="cube.mesh" scale=20 position=" 700, 200, 100" />
    22           </waypoints>
    23         </WaypointPatrolController>
    24       </controller>
     15        <controller>
     16                <WaypointPatrolController alertnessradius=1000 team=5>
     17                        <waypoints>
     18                                <Model mesh="cube.mesh" scale=0 position=" 700, 200, 100" />
     19                        </waypoints>
     20                </WaypointPatrolController>
     21        </controller>
    2522
    2623
    2724    <attached>
    28       <Model position="0,0,0" scale=45 mesh="Tower.mesh" />
     25                <Model position="0,0,0" scale=45 mesh="Tower.mesh" />
    2926    </attached>
    3027
  • code/branches/presentation2012/data/levels/towerDefense.oxw

    r9229 r9245  
    2727  <Pawn>
    2828    <camerapositions>
    29       <CameraPosition position="0,0,2000"/>
     29      <CameraPosition position="0,0,1500"/>
    3030    </camerapositions>
    3131  </Pawn>
     
    7676        <!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /-->
    7777       
    78         <SpaceShip position="-700,-500, 100" lookat="0,0,0" scale=2 team=1 >
     78        <SpaceShip position="-700,-500, 100" lookat="0,0,0" scale=3 team=1 >
    7979      <templates>
    8080        <Template link=spaceshipassff />
     
    8484          <waypoints>
    8585                          <!-- 1,3 10,3 10,11, 13,11 -->
    86             <Model mesh="cube.mesh" scale=20 position="-700,-500, 100" />
    87             <Model mesh="cube.mesh" scale=20 position=" 200,-500, 100" />
    88             <Model mesh="cube.mesh" scale=20 position=" 200, 300, 100" />
    89             <Model mesh="cube.mesh" scale=20 position=" 500, 300, 100" />
     86            <Model mesh="cube.mesh" scale=0 position="-700,-500, 150" />
     87            <Model mesh="cube.mesh" scale=0 position=" 200,-500, 150" />
     88            <Model mesh="cube.mesh" scale=0 position=" 200, 300, 150" />
     89            <Model mesh="cube.mesh" scale=0 position=" 500, 300, 150" />
     90                        <Model mesh="cube.mesh" scale=0 position=" 500, 700, 150" />
    9091          </waypoints>
    9192        </WaypointController>
     
    99100                 <attached>
    100101                        <Model position="-50,-50,0" mesh="Playfield_ME.mesh" scale=80 />
     102                        <!-- Base -->
     103                        <Model position="500,700,100" mesh="sphere.mesh" scale=80 />
    101104            <!--Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /--> <!-- Only temporary needed to help align the collisionshape -->
    102105                        <!-- This was used to mark the playfield, let's let it be here for now -->
  • code/branches/presentation2012/src/modules/towerdefense/Tower.cc

    r9229 r9245  
    2222         Constructor. Registers and initializes the object.
    2323         */
    24     Tower::Tower(BaseObject* creator) : SpaceShip(creator)
     24    Tower::Tower(BaseObject* creator) : Pawn(creator)
    2525    {
    2626        RegisterObject(Tower);
     
    3636                */
    3737    }
     38       
     39        void Tower::setOrientation(const Quaternion& orientation)
     40        {
     41                static int ori;
     42                orxout() << "orientation " << ++ori << endl;
     43        }
     44       
     45        void Tower::rotateYaw(const Vector2& value)
     46        {
     47                static int yaw;
     48                orxout() << "rotateYaw " << ++yaw << endl;
     49        }
     50       
     51        void Tower::rotatePitch(const Vector2& value)
     52        {
     53                static int pitch;
     54                orxout() << "rotatePitch " << ++pitch << endl;
     55        }
     56       
     57        void Tower::rotateRoll(const Vector2& value)
     58        {
     59                static int roll;
     60                orxout() << "rotateRoll" << ++roll << endl;
     61        }
     62               
    3863        // This function is called whenever a player presses the up or the down key.
    3964    // You have to implement what happens when the up or the down key is pressed.
     
    5580         A vector whose first component is the angle by which to rotate.
    5681         */
     82                 /*
    5783    void Tower::moveFrontBack(const Vector2& value)
    5884    {
    5985        //orxout() << "frontBack.x: " << value.x << endl;
    6086    }
     87        */
    6188       
    6289    /**
     
    6693         A vector whose first component is the direction in which we want to steer the stone.
    6794         */
     95                 /*
    6896    void Tower::moveRightLeft(const Vector2& value)
    6997    {
    7098                //orxout() << "rightLeft.x: " << value.x << endl;
    71                 /*
     99               
    72100        if(!this->delay_)
    73101        {
     
    80108            this->delay_ = true;
    81109            this->delayTimer_.startTimer();
    82         }
    83                  */
     110                }
    84111    }
     112        */
    85113}
  • code/branches/presentation2012/src/modules/towerdefense/Tower.h

    r9229 r9245  
    2020#include "towerdefense/TowerDefensePrereqs.h"
    2121#include "worldentities/pawns/SpaceShip.h"
     22       
    2223
    2324namespace orxonox
    2425{
    25     class _OrxonoxExport Tower : public SpaceShip
     26    class _OrxonoxExport Tower : public Pawn
    2627    {
    2728        public:
     
    2930                virtual ~Tower() {};
    3031               
     32                // Maybe later override these to move towers with cursor keys
     33                /*
    3134                virtual void moveFrontBack(const Vector2& value);
    3235                virtual void moveRightLeft(const Vector2& value);
     36                */
     37               
     38                // Overriding these to stop towers from spasing out
     39                void setOrientation(const Quaternion& orientation);
     40        virtual void rotateYaw(const Vector2& value);
     41        virtual void rotatePitch(const Vector2& value);
     42        virtual void rotateRoll(const Vector2& value);
    3343               
    3444                void setGame(TowerDefense* towerdefense)
  • code/branches/presentation2012/src/modules/towerdefense/TowerDefense.cc

    r9229 r9245  
    105105                /* Temporary hack to allow the player to add towers */
    106106                this->dedicatedAddTower_ = createConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) );
    107        
    108                 // Quick hack to test waypoints
    109                 createConsoleCommand( "aw", createExecutor( createFunctor(&TowerDefense::addWaypointsAndFirstEnemy, this) ) );
    110107    }
    111108       
     
    131128        Deathmatch::start();
    132129               
    133         orxout() << "Adding towers for debug..." << endl;
    134                
    135                 // Mark corners
    136                 addTower(0,15); addTower(15,0);
    137                
    138                 // Mark diagonal line
    139                 for (int i = 0 ; i <= 15; i++)
    140                         addTower(i,i);
    141                
    142                 orxout() << "Done" << endl;
     130                const int kInitialTowerCount = 3;
     131                Coordinate initialTowerCoordinates[kInitialTowerCount] = {{3,2}, {8,5}, {12,10}};
     132               
     133                for (int i = 0; i < kInitialTowerCount; i++)
     134                {
     135                        Coordinate coordinate = initialTowerCoordinates[i];
     136                        addTower(coordinate.x, coordinate.y);
     137                }
    143138               
    144139                ChatManager::message("Use the console command addTower x y to add towers");
    145140
    146141                //TODO: let the player control his controllable entity && TODO: create a new ControllableEntity for the player
    147 
    148142        }
    149143       
     
    198192                newTower->addTemplate(this->center_->getTowerTemplate());
    199193
    200                 //this->center_->attach(newTower);
    201 
    202                 newTower->setPosition((x-8) * tileScale, (y-8) * tileScale, 100);
     194                newTower->setPosition((x-8) * tileScale, (y-8) * tileScale, 75);
    203195                newTower->setGame(this);
    204                 //TODO: Save the Tower in a Vector. I would suggest std::vector< std::vector<Tower*> > towers_ as a protected member variable;
    205                
    206                 // TODO: create Tower mesh
    207                 // TODO: load Tower mesh
    208196        }
    209197       
     
    229217    {
    230218        SUPER(TowerDefense, tick, dt);
    231                
    232         static int test = 0;
    233         if (++test == 10)
    234         {
    235                         orxout()<< "10th tick." <<endl;
    236                         /*
    237                         for (std::set<SpawnPoint*>::iterator it = this->spawnpoints_.begin(); it != this->spawnpoints_.end(); it++)
    238                         {
    239                                 orxout() << "checking spawnpoint with name " << (*it)->getSpawnClass()->getName() << endl;
    240                         }
    241                         */
    242                        
    243                         //addWaypointsAndFirstEnemy();
    244                        
    245         }
    246219    }
    247220       
     
    249222       
    250223        // THE PROBLEM: WaypointController's getControllableEntity() returns null, so it won't track. How do we get the controlableEntity to NOT BE NULL???
    251        
     224        /*
    252225        void TowerDefense::addWaypointsAndFirstEnemy()
    253226        {
     
    283256//              this->center_->attach(newShip);
    284257        }
    285        
     258        */
    286259        /*
    287260         void TowerDefense::playerEntered(PlayerInfo* player)
  • code/branches/presentation2012/src/modules/towerdefense/TowerDefense.h

    r9229 r9245  
    7878
    7979        private:
    80 //              WeakPtr<TowerDefenseCenterpoint> center_;
    8180                TowerDefenseCenterpoint *center_;
    8281               
     
    9291                } Coordinate;
    9392               
    94        
    95                
    9693                std::vector<Coordinate> addedTowersCoordinates_;
    9794                std::vector<Tower*> towers_;
    98                
    99                 void addWaypointsAndFirstEnemy();
    10095    };
    10196}
  • code/branches/presentation2012/src/modules/towerdefense/TowerDefensePlayerStats.h

    r9229 r9245  
    4343{
    4444        typedef enum _TowerCosts {
    45                 TDDefaultTowerCost = 200
     45                // Set to 0 for debug...
     46                TDDefaultTowerCost = 0
    4647        } TowerCost;
    4748       
Note: See TracChangeset for help on using the changeset viewer.