Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 6, 2008, 5:31:58 PM (16 years ago)
Author:
landauf
Message:

several improvements:

  • AI works properly now - add enemies with 'createEnemy x' where x is the number of enemies to add, default is 1. You can remove AI ships with 'killEnemies'.
  • Added new explosion (with smoke)
  • Added new projectile (with trail)
  • Added new thruster emitter
  • AI ships are destroyable - they start with 100 hp, each hit makes 15 hp damage, this value is configurable in the config-file: [Projectile] damage_
  • Added AI ship spawn and explosion effects
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/SpaceShip.cc

    r1535 r1552  
    4444#include "core/input/InputManager.h"
    4545#include "particle/ParticleInterface.h"
    46 #include "Projectile.h"
    4746#include "RotatingProjectile.h"
     47#include "ParticleProjectile.h"
    4848#include "core/XMLPort.h"
    4949#include "core/ConsoleCommand.h"
     
    6969    SpaceShip* SpaceShip::instance_s;
    7070
    71    
     71
    7272    SpaceShip *SpaceShip::getLocalShip(){
    7373      Iterator<SpaceShip> it;
     
    8888      cam_(0),
    8989      camName_("CamNode"),
    90       tt_(0),
     90      tt1_(0),
     91      tt2_(0),
    9192      redNode_(0),
    9293      greenNode_(0),
     
    111112      mouseX_(0.0f),
    112113      mouseY_(0.0f),
    113       emitterRate_(0.0f),
    114114      myShip_(false),
    115115      teamNr_(0),
     
    138138    SpaceShip::~SpaceShip()
    139139    {
    140         if (this->tt_)
    141             delete this->tt_;
     140        if (this->tt1_)
     141            delete this->tt1_;
     142        if (this->tt2_)
     143            delete this->tt2_;
    142144        if(setMouseEventCallback_)
    143145          InputManager::removeMouseHandler("SpaceShip");
     
    180182    {
    181183        // START CREATING THRUSTER
    182         this->tt_ = new ParticleInterface(GraphicsEngine::getSingleton().getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow");
    183         this->tt_->getParticleSystem()->setParameter("local_space","true");
    184         this->tt_->newEmitter();
    185 /*
    186         this->tt_->setDirection(Vector3(0,0,1));
    187         this->tt_->setPositionOfEmitter(0, Vector3(20,-1,-15));
    188         this->tt_->setPositionOfEmitter(1, Vector3(-20,-1,-15));
    189 */
    190         this->tt_->setDirection(Vector3(-1,0,0));
    191         this->tt_->setPositionOfEmitter(0, Vector3(-15,20,-1));
    192         this->tt_->setPositionOfEmitter(1, Vector3(-15,-20,-1));
    193         this->tt_->setVelocity(50);
    194 
    195         emitterRate_ = tt_->getRate();
    196 
    197         Ogre::SceneNode* node2 = this->getNode()->createChildSceneNode(this->getName() + "particle2");
    198         node2->setInheritScale(false);
    199         tt_->addToSceneNode(node2);
     184        this->tt1_ = new ParticleInterface("Orxonox/thruster1");
     185        this->tt1_->createNewEmitter();
     186        this->tt1_->getAllEmitters()->setDirection(-this->getInitialDir());
     187        this->tt1_->getEmitter(0)->setPosition(Vector3(-15, 20, -1));
     188        this->tt1_->getEmitter(1)->setPosition(Vector3(-15, -20, -1));
     189        this->tt1_->setSpeedFactor(3.0);
     190
     191        Ogre::SceneNode* node2a = this->getNode()->createChildSceneNode(this->getName() + "particle2a");
     192        node2a->setInheritScale(false);
     193        node2a->setScale(1, 1, 1);
     194        tt1_->addToSceneNode(node2a);
     195
     196        this->tt2_ = new ParticleInterface("Orxonox/thruster2");
     197        this->tt2_->createNewEmitter();
     198        this->tt2_->getAllEmitters()->setDirection(Vector3(-1, 0, 0));
     199        this->tt2_->getEmitter(0)->setPosition(Vector3(-30, 40, -2));
     200        this->tt2_->getEmitter(1)->setPosition(Vector3(-30, -40, -2));
     201
     202        Ogre::SceneNode* node2b = this->getNode()->createChildSceneNode(this->getName() + "particle2b");
     203        node2b->setInheritScale(false);
     204        node2b->setScale(0.5, 0.5, 0.5);
     205        tt2_->addToSceneNode(node2b);
    200206        // END CREATING THRUSTER
    201207
     
    266272      this->camNode_ = this->getNode()->createChildSceneNode(camName_);
    267273      COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl;
    268       this->camNode_->setPosition(Vector3(-50,0,10));
     274      this->camNode_->setPosition(Vector3(-25,0,5));
    269275//      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
    270276//      Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,0,-1));
     
    339345    }
    340346
    341     Vector3 SpaceShip::getDir() {
    342         return currentDir_;
    343     }
    344 
    345     Vector3 SpaceShip::getOrth(){
    346         return currentOrth_;
    347     }
    348 
    349     float SpaceShip::getMaxSpeed() { return maxSpeed_; }
    350 
    351347    void SpaceShip::tick(float dt)
    352348    {
     
    374370        {
    375371
    376             Projectile *p;
    377             if (this->isExactlyA(Class(SpaceShip)))
    378                 p = new RotatingProjectile(this);
    379             else
    380                 p = new Projectile(this);
    381             p->setColour(this->getProjectileColour());
    382             p->create();
    383             if(p->classID==0)
     372            BillboardProjectile* projectile = new ParticleProjectile(this);
     373            projectile->setColour(this->getProjectileColour());
     374            projectile->create();
     375            if (projectile->classID == 0)
     376            {
    384377              COUT(3) << "generated projectile with classid 0" <<  std::endl; // TODO: remove this output
    385 
    386             p->setBacksync(true);
     378            }
     379
     380            projectile->setBacksync(true);
    387381            this->timeToReload_ = this->reloadTime_;
    388382        }
     
    464458
    465459        if (this->acceleration_.x > 0)
    466             this->tt_->setRate(emitterRate_);
     460        {
     461            this->tt1_->setEnabled(true);
     462            this->tt2_->setEnabled(true);
     463        }
    467464        else
    468             this->tt_->setRate(0);
     465        {
     466            this->tt1_->setEnabled(false);
     467            this->tt2_->setEnabled(false);
     468        }
    469469
    470470        if( myShip_ )
Note: See TracChangeset for help on using the changeset viewer.