Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9229


Ignore:
Timestamp:
May 23, 2012, 1:07:29 PM (13 years ago)
Author:
decapitb
Message:

merged towerdefense

Location:
code/branches/presentation2012
Files:
10 edited
30 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2012

  • code/branches/presentation2012/data/levels/emptyLevel.oxw

    r9016 r9229  
    2323  <?lua include("includes/notifications.oxi") ?>
    2424
     25
    2526  <Scene
    2627    ambientlight = "0.8, 0.8, 0.8"
     
    3031    <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"/>
    3132    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff2 />
    32    
     33 
     34
    3335  </Scene>
    3436</Level>
  • code/branches/presentation2012/data/levels/portals.oxw

    r9016 r9229  
    2929        <PortalEndPoint>
    3030            <attached>
    31                 <Billboard material="Portals/Default" />
     31                <Model mesh="Spacegate.mesh" yaw="90"/>
    3232            </attached>
    3333        </PortalEndPoint>
  • code/branches/presentation2012/data/levels/teamDeathMatch.oxw

    r9016 r9229  
    2525  <Scene
    2626   ambientlight = "0.7, 0.6, 0.6"
    27    skybox       = "Orxonox/skypanoramagen1"
     27   skybox       = "Orxonox/creeper1"
    2828  >
    2929    <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" />
  • code/branches/presentation2012/data/levels/templates/spaceshipPirate.oxt

    r8858 r9229  
    3535   angularDamping    = 0.9999999
    3636  >
     37
    3738    <engines>
    3839      <MultiStateEngine position=" 0, 0, 0" template=spaceshippirateengine />
    3940    </engines>
    4041    <attached>
    41       <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="pirate.mesh" />
     42      <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=20 mesh="pirate.mesh" />
    4243      <BlinkingBillboard position=" 12.7,-3.8,0" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 />
    4344      <BlinkingBillboard position="-12.7,-3.8,0" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 phase="90"/>
  • code/branches/presentation2012/data/levels/theTimeMachine.oxw

    r9016 r9229  
    5757?>
    5858  </SpaceShip>
     59</Template>
     60
     61<Template name=spaceshipassffengine baseclass=MultiStateEngine>
     62  <MultiStateEngine
     63   boostfactor    = 2
     64
     65   speedfront     = 150
     66   speedback      =  50
     67   speedleftright =  50
     68   speedupdown    =  50
     69
     70   defEngineSndNormal = "sounds/Engine_low.ogg"
     71   defEngineSndBoost = "sounds/Engine_high.ogg"
     72
     73   accelerationfront     = 500
     74   accelerationbrake     = 500
     75   accelerationback      =  125
     76   accelerationleftright =  125
     77   accelerationupdown    =  125
     78  >
     79
     80  </MultiStateEngine>
    5981</Template>
    6082
  • code/branches/presentation2012/src/modules/CMakeLists.txt

    r8706 r9229  
    3838ADD_SUBDIRECTORY(weapons)
    3939ADD_SUBDIRECTORY(docking)
     40ADD_SUBDIRECTORY(towerdefense)
  • code/branches/presentation2012/src/orxonox/controllers/FormationController.cc

    r9016 r9229  
    272272        }
    273273
    274         Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
     274        Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
    275275        float distance = (target - this->getControllableEntity()->getPosition()).length();
    276 
     276                if(coord.x < 0.0001 && coord.y < 0.0001)
     277                {
     278                        // if the ship reaches a direction very close to the direct one, set it to the direct one
     279                        Vector3 v_temp = this->getControllableEntity()->getPosition();
     280                        Quaternion quat = v_temp.getRotationTo(target);
     281                        this->getControllableEntity()->rotate(quat);
     282                }
    277283
    278284        if(this->state_ == FREE)
     
    281287            {
    282288                // Multiply with ROTATEFACTOR_FREE to make them a bit slower
    283                 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x*coord.x);
    284                 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y*coord.y);
    285             }
    286 
    287             if (this->target_ && distance < 200 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())
     289                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * coord.x * 2);
     290                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * coord.y * 2);
     291            }
     292
     293            if (this->target_ && distance <  200 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())
    288294            {
    289295              this->getControllableEntity()->moveFrontBack(-0.05f); // They don't brake with full power to give the player a chance
     
    297303            if (this->target_ || distance > 10)
    298304            {
    299                 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);
    300                 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);
     305                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * coord.x * 2);
     306                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * coord.y * 2);
    301307            }
    302308
     
    310316
    311317        if(this->state_ == SLAVE)
    312         {
    313 
    314            this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);
    315            this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);
    316 
    317             if (distance < 300)
    318             {
    319                  if (bHasTargetOrientation_)
    320                     {
    321                         copyTargetOrientation();
    322                     }
    323                 if (distance < 100)
    324                 {  //linear speed reduction
    325                     this->getControllableEntity()->moveFrontBack(distance/100.0f*0.4f*SPEED_MASTER);
    326                    
    327                 } else this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER);
    328 
    329             } else {
    330                 this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER + distance/300.0f);
    331             }
    332         }
     318                {
     319
     320                        this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * coord.x * 2);
     321                        this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * coord.y * 2);
     322
     323                        if (distance < 300)
     324                        {
     325                                if (bHasTargetOrientation_)
     326                                {
     327                                        copyTargetOrientation();
     328                                }
     329                                if (distance < 100)
     330                                { //linear speed reduction
     331                                        this->getControllableEntity()->moveFrontBack(distance/100.0f*0.4f*SPEED_MASTER);
     332
     333                                } else this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER);
     334
     335                        } else {
     336                                this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER + distance/300.0f);
     337                        }
     338                }
    333339
    334340        if (distance < 10)
     
    383389    void FormationController::searchNewMaster()
    384390    {
    385         if (this->state_==SLAVE) 
     391        if (this->state_==SLAVE)
    386392           return;
    387393        if (!this->getControllableEntity())
     
    394400        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)
    395401        {
    396            
     402
    397403            //same team?
    398404            Gametype* gt=this->getGametype();
     
    479485                 bool left=true;
    480486            int i = 1;
    481            
     487
    482488            for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
    483489            {
     
    490496                    i++;
    491497                    dest+=FORMATION_LENGTH*(orient*WorldEntity::BACK);
    492                 }               
     498                }
    493499                (*it)->setTargetOrientation(orient);
    494500                (*it)->setTargetPosition(pos);
     
    599605
    600606        if (this->state_==SLAVE)  //become master of this formation
    601         {   
     607        {
    602608            this->slaves_=this->myMaster_->slaves_;
    603609            this->myMaster_->slaves_.clear();
    604610            this->myMaster_->state_=SLAVE;
    605611            this->myMaster_->myMaster_=this;
    606            
     612
    607613            //delete myself in slavelist
    608614            std::vector<FormationController*>::iterator it2 = std::find(this->slaves_.begin(), this->slaves_.end(), this);
     
    647653           if (i>=slaves_.size()/2) break; //half the formation should attack.
    648654       }
    649     }     
     655    }
    650656
    651657
     
    860866    void FormationController::setTargetOrientation(const Quaternion& orient)
    861867    {
    862         this->targetOrientation_=orient;       
     868        this->targetOrientation_=orient;
    863869        this->bHasTargetOrientation_=true;
    864870    }
  • code/branches/presentation2012/src/orxonox/controllers/WaypointController.cc

    r8891 r9229  
    6262    void WaypointController::tick(float dt)
    6363    {
    64         if (!this->isActive())
     64                if (!this->isActive())
    6565            return;
     66
    6667
    6768        if (this->waypoints_.size() == 0 || !this->getControllableEntity())
    6869            return;
    6970
     71
    7072        if (this->waypoints_[this->currentWaypoint_]->getWorldPosition().squaredDistance(this->getControllableEntity()->getPosition()) <= this->squaredaccuracy_)
    7173            this->currentWaypoint_ = (this->currentWaypoint_ + 1) % this->waypoints_.size();
     74
    7275
    7376        this->moveToPosition(this->waypoints_[this->currentWaypoint_]->getWorldPosition());
  • code/branches/presentation2012/src/orxonox/worldentities/WorldEntity.cc

    r8858 r9229  
    379379        if (!object->notifyBeingAttached(this))
    380380            return;
    381 
    382381        this->attachNode(object->node_);
    383382        this->children_.insert(object);
Note: See TracChangeset for help on using the changeset viewer.