Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2006, 3:19:40 PM (18 years ago)
Author:
marcscha
Message:

weapon, collision, particles

Location:
branches/playability/src/world_entities/projectiles
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/projectiles/mbolt.cc

    r10042 r10064  
    2424
    2525#include "particles/dot_emitter.h"
     26#include "particles/box_emitter.h"
    2627#include "particles/sprite_particles.h"
     28
     29#include "space_ships/space_ship.h"
    2730
    2831#include <cassert>
     
    3336
    3437#include "class_id_DEPRECATED.h"
     38ObjectListDefinition(MBolt);
    3539CREATE_FAST_FACTORY_STATIC(MBolt);
    3640
     
    4044MBolt::MBolt () : Projectile()
    4145{
    42 
     46  this->registerObject(this, MBolt::_objectList);
    4347  this->loadModel("models/projectiles/mbolt.obj",0.25);
    4448  //this->loadModel("models/projectiles/laser.obj");
     
    4953  this->angle     = 0;
    5054
    51   this->emitter = new DotEmitter(40, 0, M_2_PI);
     55
     56  //this->emitter = new DotEmitter(1000, 0, 0);
     57  this->emitter = new BoxEmitter(Vector(8,1,1)*dynamic_cast<StaticModel*>(this->getModel())->getScaleFactor(), 1000, 0, 0);
    5258  this->emitter->setParent(this);
    53   this->emitter->setSpread(M_PI, M_PI);
    54   this->emitter->setEmissionRate(300.0);
    55   this->emitter->setEmissionVelocity(50.0);
     59  this->emitter->setSpread(M_PI,M_PI);
     60  this->emitter->setInheritSpeed(this->velocity.len());
     61  this->emitter->setEmissionRate(500.0);
     62  this->emitter->setEmissionVelocity(this->velocity.len());
    5663
    5764  this->mat = new Material("mBolt");
     
    5966  this->mat->setBlendFunc(GL_SRC_ALPHA,GL_ONE);
    6067  this->mat->setDiffuse(1,1,1);
    61   this->mat->setDiffuseMap("laser.png");
     68  this->mat->setDiffuseMap("laser_add.png");
    6269  this->mat->setDiffuseMap("laser.png",1);
     70
    6371  dynamic_cast<StaticModel*>(this->getModel())->addMaterial(this->mat);
    6472  dynamic_cast<StaticModel*>(this->getModel())->finalize();
     
    99107    MBolt::trailParticles->setName("BoomerangProjectileTrailParticles");
    100108    MBolt::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");
    101     MBolt::trailParticles->setLifeSpan(1, 0);
    102     MBolt::trailParticles->setRadius(0.0, 1);
    103     MBolt::trailParticles->setRadius(1.0, 1);
     109    MBolt::trailParticles->setLifeSpan(0.3, 0);
     110    MBolt::trailParticles->setRadius(0.0, .8);
     111    MBolt::trailParticles->setRadius(1.0, .2);
    104112    MBolt::trailParticles->setColor(0.0, 1,0,0,.9);
    105113    MBolt::trailParticles->setColor(0.2, .8,.2,0,.9);
    106     MBolt::trailParticles->setColor(0.5, .8,.4,0,.8);
    107     MBolt::trailParticles->setColor(1.0, .8,.8,0,.7);
     114    MBolt::trailParticles->setColor(0.5, .8,.4,.4,.8);
     115    MBolt::trailParticles->setColor(1.0, .8,.8,.8,.7);
    108116  }
    109117  if (unlikely(MBolt::explosionParticles == NULL))
     
    125133  this->emitter->setSystem(MBolt::trailParticles);
    126134
     135  this->emitter->setSpread(0);
     136  this->emitter->setEmissionRate(80.0);
     137  this->emitter->setEmissionVelocity(0);
    127138  this->updateNode(0);
    128   this->emitter->setSpread(0);
    129   this->emitter->setEmissionRate(20.0);
    130   this->emitter->setEmissionVelocity(this->velocity.len());
    131139}
    132140
     
    152160    this->destroy( entity );
    153161  this->hitEntity = entity;
     162  dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0);
    154163}
    155164
  • branches/playability/src/world_entities/projectiles/mbolt.h

    r10042 r10064  
    1818class MBolt : public Projectile
    1919{
    20   //ObjectListDeclaration(MBolt);
     20  ObjectListDeclaration(MBolt);
    2121  public:
    2222    MBolt ();
     
    4141
    4242    float                             angle;
    43     static const float                rotationSpeed = 540;
     43    static const float                rotationSpeed = 1080;
    4444
    4545    ParticleEmitter*                  emitter;
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10039 r10064  
    2323#include "particles/dot_emitter.h"
    2424#include "particles/sprite_particles.h"
     25#include "space_ships/space_ship.h"
    2526
    2627#include "debug.h"
     
    4445  this->setMinEnergy(1);
    4546  this->setHealthMax(10);
    46   this->lifeSpan = 2.0;
     47  this->lifeSpan = 4.0;
    4748  this->agility = 3.5;
    4849  this->maxVelocity = 100;
     
    6465SwarmProjectile::~SwarmProjectile ()
    6566{
    66   // delete this->emitter;
     67
    6768
    6869  /* this is normaly done by World.cc by deleting the ParticleEngine */
     
    7980    SwarmProjectile::explosionParticles = NULL;
    8081  }
    81 
     82   delete this->emitter;
    8283}
    8384
     
    9697    SwarmProjectile::trailParticles->setLifeSpan(1.0, .3);
    9798    SwarmProjectile::trailParticles->setRadius(0.0, .5);
    98     SwarmProjectile::trailParticles->setRadius(0.2, 4.0);
    99     SwarmProjectile::trailParticles->setRadius(.5, 1.5);
    100     SwarmProjectile::trailParticles->setRadius(1.0, 1.5);
     99    SwarmProjectile::trailParticles->setRadius(0.2, 2.0);
     100    SwarmProjectile::trailParticles->setRadius(.5, 1.0);
     101    SwarmProjectile::trailParticles->setRadius(1.0, 0.6);
    101102    SwarmProjectile::trailParticles->setColor(0.0, 1,0,0,.7);
    102103    SwarmProjectile::trailParticles->setColor(0.2, .8,.8,0,.5);
     
    145146    this->destroy( entity );
    146147  this->hitEntity = entity;
     148  dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0);
    147149}
    148150
Note: See TracChangeset for help on using the changeset viewer.