Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7103 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Feb 7, 2006, 9:45:52 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: explosion works :)

Location:
trunk/src/world_entities
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/effects/explosion.cc

    r7047 r7103  
    2323#include "class_list.h"
    2424
    25 #include "dot_emitter.h"
     25#include "box_emitter.h"
    2626#include "sprite_particles.h"
    2727
     
    3030
    3131CREATE_FAST_FACTORY_STATIC(Explosion, CL_EXPLOSION);
     32
    3233
    3334/**
     
    3839  this->setClassID(CL_EXPLOSION, "Explosion");
    3940
    40   this->emitter = new DotEmitter(100, 5, M_2_PI);
     41  this->emitter = new BoxEmitter(Vector(10,10,10), 300, 50, M_2_PI);
    4142  this->emitter->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    4243  this->emitter->setParent(this);
     
    4445
    4546  this->lifeCycle = 0.0f;
    46   this->lifeTime = 4.0f;
     47  this->lifeTime = 0.5f;
    4748
    4849}
     
    6364SpriteParticles* Explosion::explosionParticles = NULL;
    6465
     66void Explosion::explode(PNode* position, const Vector& size)
     67{
     68  Explosion* explosion = dynamic_cast<Explosion*>(Explosion::fastFactory->resurrect());
     69  explosion->setParent(position);
     70  explosion->emitter->setSize(size);
     71  explosion->activate();
     72}
     73
     74
    6575void Explosion::activate()
    6676{
    6777  if (unlikely(Explosion::explosionParticles == NULL))
    6878  {
    69     Explosion::explosionParticles = new SpriteParticles(200);
     79    Explosion::explosionParticles = new SpriteParticles(5000);
    7080    Explosion::explosionParticles->setName("ExplosionExplosionParticles");
    7181    Explosion::explosionParticles->setMaterialTexture("maps/radial-trans-noise.png");
     
    7484    Explosion::explosionParticles->setRadius(.5, 15.0);
    7585    Explosion::explosionParticles->setRadius(1.0, 10.0);
    76     Explosion::explosionParticles->setColor(0.0, 0,1,0,1);
     86    Explosion::explosionParticles->setColor(0.0, 1,0,0,1);
    7787    Explosion::explosionParticles->setColor(0.5, .8,.8,0,.8);
    7888    Explosion::explosionParticles->setColor(0.8, .8,.8,.3,.8);
     
    8696  this->emitter->setEmissionVelocity(0.0);
    8797  this->toList(OM_DEAD_TICK);
     98  this->lifeCycle = 0.0;
    8899}
    89100
     
    92103{
    93104  this->emitter->setSystem(NULL);
    94   this->lifeCycle = 0.0;
    95105  this->toList(OM_DEAD);
    96 
     106  this->emitter->setParent(PNode::getNullParent());
    97107  Explosion::fastFactory->kill(this);
    98108}
  • trunk/src/world_entities/effects/explosion.h

    r7047 r7103  
    1010
    1111class SpriteParticles;
    12 class ParticleEmitter;
     12class BoxEmitter;
    1313class FastFactory;
    1414
     
    1616{
    1717  public:
     18    static void explode (PNode* position, const Vector& size);
     19
    1820    Explosion ();
    1921    virtual ~Explosion ();
     
    3032    float                      lifeCycle;
    3133
    32     static SpriteParticles*           explosionParticles;
    33     ParticleEmitter*           emitter;
     34    static SpriteParticles*    explosionParticles;
     35    BoxEmitter*           emitter;
    3436};
    3537
  • trunk/src/world_entities/npcs/ground_turret.cc

    r7102 r7103  
    2727#include "load_param.h"
    2828
     29#include "effects/explosion.h"
     30
    2931CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET);
    3032
     
    6062{
    6163  this->setClassID(CL_GROUND_TURRET, "GroundTurret");
    62   this->loadModel("models/ground_turret.obj", 5);
     64  this->loadModel("models/ground_turret_#.obj", 5);
    6365  this->left = NULL;
    6466  this->right = NULL;
     
    176178{
    177179  this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90);
     180  Explosion::explode(this, Vector(5,50,0));
    178181}
    179182
  • trunk/src/world_entities/power_ups/power_up.cc

    r7102 r7103  
    120120void PowerUp::collidesWith (WorldEntity* entity, const Vector& location)
    121121{
    122   if(entity->isA(CL_EXTENDABLE))
     122  if(this->collider != entity && entity->isA(CL_EXTENDABLE))
    123123  {
    124124    this->collider = entity;
Note: See TracChangeset for help on using the changeset viewer.