Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10073 in orxonox.OLD for branches/playability


Ignore:
Timestamp:
Dec 13, 2006, 10:30:51 PM (18 years ago)
Author:
marcscha
Message:

Emitter Node implemented, first steps for swarm missile in

Location:
branches/playability/src/world_entities
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/WorldEntities.am

    r10044 r10073  
    8888                world_entities/particles/box_emitter.cc \
    8989                world_entities/particles/plane_emitter.cc \
     90        world_entities/particles/emitter_node.cc \
    9091                \
    9192                world_entities/particles/particle_system.cc \
     
    199200                particles/box_emitter.h \
    200201                particles/plane_emitter.h \
     202        particles/emitter_node.h \
    201203                \
    202204                particles/particle_system.h \
  • branches/playability/src/world_entities/particles/particle_emitter.h

    r9869 r10073  
    3636  void start();
    3737  void stop();
    38   void tick(float dt);
     38  virtual void tick(float dt);
    3939
    4040  void setSystem(ParticleSystem* system);
     
    7474  float           momentumRandom;    //!< The random variation of the Momentum.
    7575
    76 private:
     76//private:
    7777  ParticleSystem* system;            //!< The ParticleSystem this Emitter Emits into.
    7878  float           saveTime;          //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big).
  • branches/playability/src/world_entities/projectiles/mbolt.cc

    r10064 r10073  
    128128  }
    129129
    130   this->setDamage(50);
     130  this->setDamage(10);
    131131  this->setHealth(0);
    132132
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10064 r10073  
    9393  {
    9494    SwarmProjectile::trailParticles = new SpriteParticles(2000);
    95     SwarmProjectile::trailParticles->setName("BoomerangProjectileTrailParticles");
     95    SwarmProjectile::trailParticles->setName("SwarmProjectileTrailParticles");
    9696    SwarmProjectile::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");
    97     SwarmProjectile::trailParticles->setLifeSpan(1.0, .3);
     97    SwarmProjectile::trailParticles->setLifeSpan(.5, 0);
    9898    SwarmProjectile::trailParticles->setRadius(0.0, .5);
    99     SwarmProjectile::trailParticles->setRadius(0.2, 2.0);
     99    SwarmProjectile::trailParticles->setRadius(0.2, 1.5);
    100100    SwarmProjectile::trailParticles->setRadius(.5, 1.0);
    101101    SwarmProjectile::trailParticles->setRadius(1.0, 0.6);
     
    108108  {
    109109    SwarmProjectile::explosionParticles = new SpriteParticles(200);
    110     SwarmProjectile::explosionParticles->setName("BoomerangProjectileExplosionParticles");
     110    SwarmProjectile::explosionParticles->setName("SwarmProjectileExplosionParticles");
    111111    SwarmProjectile::explosionParticles->setMaterialTexture("maps/radial-trans-noise.png");
    112112    SwarmProjectile::explosionParticles->setLifeSpan(.5, .3);
     
    123123
    124124  this->updateNode(0);
    125   this->emitter->setEmissionRate(45.0);
     125  this->emitter->setEmissionRate(160.0);
    126126  this->emitter->setEmissionVelocity(0.0);
    127127
     
    254254  this->emitter->setEmissionRate(1000.0);
    255255  this->emitter->setEmissionVelocity(50.0);
    256   //  this->deactivate();
     256  this->deactivate();
    257257
    258258}
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10064 r10073  
    3232
    3333#include "particles/dot_emitter.h"
     34#include "particles/emitter_node.h"
    3435#include "particles/sprite_particles.h"
    3536
     
    8485{
    8586  this->setPlayer(NULL);
    86   delete this->emitter;
    8787}
    8888
     
    144144
    145145  Weapon* wpRight1 = new LightBlaster ();
    146   wpRight1->setName("LightBlaster");
     146  wpRight1->setName( "LightBlaster");
     147  wpRight1->setParent( this);
    147148  Weapon* wpLeft1 = new LightBlaster ();
    148   wpLeft1->setName("LightBlaster");
     149  wpLeft1->setName( "LightBlaster");
     150  wpLeft1->setParent( this);
    149151
    150152  Weapon* wpRight2 = new MediumBlaster ();
    151   wpRight2->setName("MediumBlaster");
     153  wpRight2->setName( "MediumBlaster");
     154  wpRight2->setParent( this);
    152155  Weapon* wpLeft2 = new MediumBlaster ();
    153   wpLeft2->setName("MediumBlaster");
     156  wpLeft2->setName( "MediumBlaster");
     157  wpLeft2->setParent( this);
    154158
    155159  Weapon* wpRight3 = new HeavyBlaster ();
    156   wpRight3->setName("HeavyBlaster");
     160  wpRight3->setName( "HeavyBlaster");
     161  wpRight3->setParent( this);
    157162  Weapon* wpLeft3 = new HeavyBlaster ();
    158   wpLeft3->setName("HeavyBlaster");
     163  wpLeft3->setName( "HeavyBlaster");
     164  wpLeft3->setParent( this);
    159165
    160166  Weapon* cannon = new SwarmLauncher();
    161   cannon->setName("SwarmLauncher");
    162  
     167  cannon->setName( "SwarmLauncher");
     168  cannon->setParent( this);
    163169
    164170
     
    241247  registerEvent(EV_MOUSE_MOTION);
    242248
     249  this->weaponMan.setParentEntity( this);
     250  this->secWeaponMan.setParentEntity( this);
     251
    243252  this->weaponMan.setSlotCount(6);
    244253
     
    263272  this->secWeaponMan.setSlotCount(6);
    264273
    265   this->secWeaponMan.setSlotPosition(0, Vector(1.5, -1, 0));
     274  this->secWeaponMan.setSlotPosition(0, Vector(1.5, 0, 0));
    266275  this->secWeaponMan.setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    267276
    268   this->secWeaponMan.setSlotPosition(1, Vector(2.6, .1, 3.0));
     277  this->secWeaponMan.setSlotPosition(1, Vector(2.6, 0, 3.0));
    269278  this->secWeaponMan.setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    270279
    271   this->secWeaponMan.setSlotPosition(2, Vector(1.5, .5, -.5));
     280  this->secWeaponMan.setSlotPosition(2, Vector(1.5, 0, -.5));
    272281  this->secWeaponMan.setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
    273282
    274   this->secWeaponMan.setSlotPosition(3, Vector(1.5, .5, .5));
     283  this->secWeaponMan.setSlotPosition(3, Vector(1.5, 0, .5));
    275284  this->secWeaponMan.setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
    276285
    277   this->secWeaponMan.setSlotPosition(4, Vector(1.5, -.5, .5));
     286  this->secWeaponMan.setSlotPosition(4, Vector(1.5, 0, .5));
    278287  this->secWeaponMan.setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
    279288
    280   this->secWeaponMan.setSlotPosition(5, Vector(1.5, -.5, -.5));
     289  this->secWeaponMan.setSlotPosition(5, Vector(1.5, 0, -.5));
    281290  this->secWeaponMan.setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
    282291
     
    292301  dynamic_cast<Element2D*>(this->weaponMan.getFixedTarget())->setVisibility( false);
    293302
    294   this->burstEmitter = new DotEmitter(200, 0.0, .01);
     303  this->burstEmitter = new DotEmitter(800, 0.0, .01);
    295304  this->burstEmitter->setParent(this);
    296305  this->burstEmitter->setRelCoor(-1, .5, 0);
    297306  this->burstEmitter->setName("SpaceShip_Burst_emitter");
    298   this->burstEmitter->setEmissionRate(200);
    299 
    300   this->burstSystem = new SpriteParticles(1000);
     307  this->burstEmitter->setEmissionRate(800);
     308
     309  this->burstSystem = new SpriteParticles(400);
    301310  this->burstSystem->addEmitter(this->burstEmitter);
    302311  this->burstSystem->setName("SpaceShip_Burst_System");
    303312  ((SpriteParticles*)this->burstSystem)->setMaterialTexture("maps/radial-trans-noise.png");
    304   this->burstSystem->setLifeSpan(0.4, .3);
     313  this->burstSystem->setLifeSpan(0.3, .3);
    305314  this->burstSystem->setRadius(0.0, 1.0);
    306315  this->burstSystem->setRadius(0.05, 1.0);
    307316  this->burstSystem->setRadius(.5, .6);
    308317  this->burstSystem->setRadius(1.0, 0);
    309   this->burstSystem->setColor(0.0, .7,.7,1,.7);
    310   this->burstSystem->setColor(0.2, 0,0,0.8,.5);
     318  this->burstSystem->setColor(0.0, .7,.7,1,.5);
     319  this->burstSystem->setColor(0.2, 0,0,0.8,.7);
    311320  this->burstSystem->setColor(0.5, .5,.5,.8,.8);
    312321  this->burstSystem->setColor(1.0, .8,.8,.8,.0);
    313 
    314   this->emitter = NULL;
    315322
    316323  registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) );
     
    378385{
    379386  this->secWeaponMan.hideCrosshair();
    380   this->toList(OM_GROUP_00);
     387  this->toList( OM_GROUP_00);
    381388  //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false);
    382389  //this->detachCamera();
     
    396403*/
    397404void SpaceShip::leftWorld ()
    398 {/*
    399   this->emitter->stop();
    400   delete this->emitter;
    401   delete this->explosionParticles; */
     405{
     406
    402407}
    403408
     
    573578  PRINTF(0)("spaceship destroy\n");
    574579
    575   this->explosionParticles = new SpriteParticles(1000);
    576   this->explosionParticles->setName("MBoltExplosionParticles");
    577   this->explosionParticles->setLifeSpan(.5, .3);
    578   this->explosionParticles->setRadius(0.0, 10.0);
    579   this->explosionParticles->setRadius(.5, 6.0);
    580   this->explosionParticles->setRadius(1.0, 3.0);
    581   this->explosionParticles->setColor(0.0, 1,1,0,.9);
    582   this->explosionParticles->setColor(0.5, .8,.8,0,.5);
    583   this->explosionParticles->setColor(1.0, .8,.8,.7,.0);
    584 
    585   this->emitter = new DotEmitter(100000, 0, 0);
    586   this->emitter->setParent(this);
    587   this->emitter->setSpread(M_PI,M_PI);
    588   this->emitter->setEmissionRate(50.0);
    589   this->emitter->setEmissionVelocity(50.0);
    590 
    591   this->emitter->setSystem(this->explosionParticles);
    592 
    593   this->emitter->setSpread(50);
    594   this->emitter->setEmissionRate(50.0);
    595   this->emitter->setEmissionVelocity(50.0);
    596   this->updateNode(0);
    597 
    598   this->toList(OM_DEAD);
     580  EmitterNode* node  = NULL;
     581  DotEmitter* emitter = NULL;
     582  SpriteParticles*  explosionParticles  = NULL;
     583
     584  explosionParticles = new SpriteParticles(100);
     585  explosionParticles->setName("MBoltExplosionParticles");
     586  explosionParticles->setLifeSpan(.5, .3);
     587  explosionParticles->setRadius(0.0, 10.0);
     588  explosionParticles->setRadius(.5, 6.0);
     589  explosionParticles->setRadius(1.0, 3.0);
     590  explosionParticles->setColor(0.0, 1,1,0,.9);
     591  explosionParticles->setColor(0.5, .8,.8,0,.5);
     592  explosionParticles->setColor(1.0, .8,.8,.7,.0);
     593
     594 
     595  emitter = new DotEmitter( 200, 0, 0);
     596  emitter->setSpread( M_PI, M_PI);
     597  emitter->setSpread( 50);
     598  emitter->setEmissionRate( 50.0);
     599  emitter->setEmissionVelocity( 150.0);
     600  emitter->setSystem( explosionParticles);
     601  emitter->setAbsCoor( this->getAbsCoor());
     602
     603  node  = new EmitterNode( 1);
     604  node->setupParticle( emitter, explosionParticles);
     605  node->setVelocity( this->getParent()->getVelocity());
     606  node->setAbsCoor( this->getAbsCoor());
     607  node->start();
     608
     609  this->setAbsCoor(Vector(-10000,10000,10000));
     610  this->hide();
     611
     612  this->toList( OM_DEAD);
     613    PRINTF(0)("spaceship destroy == ship translated \n");
    599614}
    600615
    601616void SpaceShip::respawn( )
    602617{
    603   toList( OM_GROUP_00 );
     618  //this->show();
     619  //this->toList( OM_GROUP_00);
    604620}
    605621
  • branches/playability/src/world_entities/space_ships/space_ship.h

    r10064 r10073  
    33 * Implements the Control of a Spaceship
    44 * Space Ships are the core class for all types of ships in Orxonox
     5 * By default is on OM_GROUP_00
     6 * If player boards the ship, it is moved to OM_GROUP_01
    57 */
    68
     
    176178    ParticleEmitter*      burstEmitter;
    177179    ParticleSystem*       burstSystem;
    178 
    179    
    180     SpriteParticles*           explosionParticles;
    181     ParticleEmitter*           emitter;
    182180};
    183181
  • branches/playability/src/world_entities/weapons/swarm_launcher.cc

    r10046 r10073  
    2525#include "animation3d.h"
    2626
     27#include <list>
     28#include <iterator>
     29#include "util/state.h"
     30
     31#include "math/quaternion.h"
     32
    2733#include "util/loading/factory.h"
    2834
    2935#include "class_id_DEPRECATED.h"
     36
     37using namespace std;
    3038
    3139ObjectListDefinitionID(SwarmLauncher, CL_SWARM_LAUNCHER);
     
    136144void SwarmLauncher::fire()
    137145{
    138   Projectile* pj = this->getProjectile();
    139   if (pj == NULL)
    140     return;
     146  Projectile* pj;
     147  int i = 0;
     148  std::list<WorldEntity*> eList  = State::getObjectManager()->getEntityList( OM_GROUP_00);
     149  list<WorldEntity*>::iterator eIterator;
     150  PRINTF(0)("Iterator output: %i\n",eList.size());
     151  for( eIterator = eList.begin(); eIterator != eList.end(); eIterator++);
     152  {
     153    PRINTF(0)("Iterator step: %i with content: %s\n",++i,*eIterator);
     154    if( (dynamic_cast<WorldEntity*>(*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 50000.0)
     155    {
     156      pj  = this->getProjectile();
     157      if (pj == NULL)
     158        return;
    141159
    142   pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*165.0 /*+ VECTOR_RAND(13) */
    143             /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    144 
    145   pj->setParent(PNode::getNullParent());
    146   pj->setAbsCoor(this->getEmissionPoint());
    147   pj->setAbsDir(this->getAbsDir());
    148   pj->activate();
     160          pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*165.0 + VECTOR_RAND(20))*.5);
     161       
     162          pj->setParent(PNode::getNullParent());
     163          pj->setAbsCoor(this->getEmissionPoint());
     164          pj->setAbsDir(this->getAbsDir());
     165          pj->setTarget( *eIterator);
     166          pj->activate();
     167      this->increaseEnergy( pj->getMinEnergy());
     168    }
     169  }
     170  this->increaseEnergy( - pj->getMinEnergy());
    149171}
  • branches/playability/src/world_entities/weapons/swarm_launcher.h

    r10023 r10073  
    88
    99#include "weapon.h"
     10
     11#define SWARM_LAUNCHER_MAXRANGE = 500.0;
    1012
    1113class SwarmLauncher : public Weapon
Note: See TracChangeset for help on using the changeset viewer.