Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 27, 2010, 3:33:15 PM (14 years ago)
Author:
gnadler
Message:
 
Location:
code/branches/rocket2/src/modules/weapons
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/rocket2/src/modules/weapons/RocketController.cc

    r6966 r6969  
    8080    void RocketController::setTargetPosition()
    8181    {
    82         //this->targetPosition_=this->target_->getWorldPosition();
    83         this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getWorldPosition(), this->target_->getVelocity());
     82        this->targetPosition_=this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD
     83        //this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getWorldPosition(), this->target_->getVelocity());
    8484    }
    8585    void RocketController::moveToTargetPosition()
  • code/branches/rocket2/src/modules/weapons/projectiles/Rocket.cc

    r6540 r6969  
    8787            this->defSndWpnEngine_->setLooping(true);
    8888            this->defSndWpnEngine_->setSource("sounds/Rocket_engine.ogg");
     89            this->defSndWpnEngine_->setVolume(100);
    8990            this->attach(defSndWpnEngine_);
    9091
     
    9293            this->defSndWpnLaunch_->setLooping(false);
    9394            this->defSndWpnLaunch_->setSource("sounds/Rocket_launch.ogg");
     95            this->defSndWpnLaunch_->setVolume(100);
    9496            this->attach(defSndWpnLaunch_);
    9597        }
  • code/branches/rocket2/src/modules/weapons/projectiles/SimpleRocket.cc

    r6966 r6969  
    5858        this->localAngularVelocity_ = 0;
    5959        this->bDestroy_ = false;
    60         this->lifetime_ = 100;
     60        this->lifetime_ = 120;
    6161        this->setMass(15);
    6262        COUT(4) << "simplerocket constructed\n";
    63         this->counter_=0;
    64         this->slowing_=false;
     63        this->maxLife_=90;
    6564
    6665        if (GameMode::isMaster())
     
    8988            collisionShape->setHeight(200);
    9089            this->attachCollisionShape(collisionShape);
    91            
    92 
    9390            this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&SimpleRocket::destroyObject, this)));
    9491        }
     
    9693    }
    9794   
    98     void SimpleRocket::disableFire(){
    99         this->setAcceleration(0,0,0);
    100         this->setVelocity(Vector3(0,0,0));
     95
     96
     97
     98    void SimpleRocket::tick(float dt)
     99    {
     100
     101        SUPER(SimpleRocket, tick, dt);
     102        if (this->getVelocity().squaredLength() >130000) this->maxLife_-=dt; //if Velocity bigger than about 360, uses a lot more "fuel" :)
    101103       
    102         this->fire_->detachFromParent();
    103         //this->fire_->setVisible(false);
    104 
    105     }
    106 
    107 
    108     void SimpleRocket::tick(float dt)
    109     {
    110 
    111         SUPER(SimpleRocket, tick, dt);
    112         counter_++;
    113         if (this->getVelocity().squaredLength() >130000 && !slowing_) counter_++; //if Velocity bigger than about 360, uses a lot more "fuel" :)
    114104
    115105            this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
     
    119109           
    120110            if (this->fuel_) {
    121                 COUT(0)<<this->getVelocity().length()<<endl;
    122                 if (this->counter_>1000 && counter_%12==0)
    123                    
    124                     if (!this->slowing_) {
    125                         this->setAcceleration(this->getOrientation()*Vector3(10,10,10));
    126                         this->slowing_=true;
    127                     }
    128 
    129                 if (this->counter_ > 1800)
     111                if (this->destroyTimer_.getRemainingTime()<  this->lifetime_-this->maxLife_ )
    130112                    this->fuel_=false;
    131             }
     113            } else this->disableFire();
     114
    132115            if( this->bDestroy_ )
    133116                this->destroy();
    134             if (!this->fuel_)
    135                 this->disableFire();
    136        
    137            
    138            
    139        
     117               
     118    }
     119
     120    void SimpleRocket::disableFire(){
     121        this->setAcceleration(0,0,0);       
     122        this->fire_->detachFromParent();
     123
    140124    }
    141125
     
    221205    }
    222206   
    223     void SimpleRocket::setDestroy()
    224     {
    225         this->bDestroy_=true;
    226         CCOUT(4)<<"trying to destroy";
    227     }
    228207
    229208    void SimpleRocket::fired(unsigned int firemode)
  • code/branches/rocket2/src/modules/weapons/projectiles/SimpleRocket.h

    r6966 r6969  
    131131            bool bDestroy_;
    132132            bool fuel_;
    133             bool slowing_;
    134             int counter_;
    135133
    136134
     
    138136            Timer destroyTimer_;
    139137            float lifetime_;
     138            float maxLife_;
     139
    140140            ParticleEmitter* fire_;
     141
     142
    141143
    142144
Note: See TracChangeset for help on using the changeset viewer.