Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Feb 8, 2006, 9:59:21 AM (19 years ago)
Author:
patrick
Message:

trunk: mp explosion

Location:
trunk/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/playable.cc

    r7100 r7118  
    3333#include "sprite_particles.h"
    3434
     35#include "effects/explosion.h"
     36
    3537
    3638Playable::Playable()
     
    5355  this->oldScore = 0;
    5456
    55 
    56   this->emitter = new DotEmitter(100, 5, M_2_PI);
    57   this->emitter->setParent(this);
    58   this->emitter->setSpread(M_PI, M_PI);
    59   this->emitter->setEmissionRate(300.0);
    60   this->emitter->setEmissionVelocity(50.0);
    61 
    62   this->explosionParticles = new SpriteParticles(1000);
    63   this->explosionParticles->setName("LaserExplosionParticles");
    64   this->explosionParticles->setLifeSpan(.5, .3);
    65   this->explosionParticles->setRadius(0.0, 10.0);
    66   this->explosionParticles->setRadius(.5, 6.0);
    67   this->explosionParticles->setRadius(1.0, 3.0);
    68   this->explosionParticles->setColor(0.0, 1,1,0,.9);
    69   this->explosionParticles->setColor(0.5, .8,.8,0,.5);
    70   this->explosionParticles->setColor(1.0, .8,.8,.7,.0);
     57  this->bDead = false;
    7158}
    7259
     
    156143    State::getGameRules()->onPlayerSpawn();
    157144
    158   this->reset();
    159 
    160145
    161146  if( this->getOwner() % 2 == 0)
     
    171156    this->setAbsDir(1.0, -0.015, -0.012, 0.011);
    172157  }
     158  this->reset();
     159  this->bDead = false;
    173160}
    174161
     
    177164void Playable::die()
    178165{
    179   PRINTF(0)("Playable dies\n");
     166  if( !this->bDead)
     167  {
     168    PRINTF(0)("Playable dies\n");
    180169  // only if this is the spaceship of the player
    181   if (State::isOnline())
    182   {
    183     if( this == State::getPlayer()->getPlayable())
    184       State::getGameRules()->onPlayerDeath();
    185 
    186 
     170    if (State::isOnline())
     171    {
     172      if( this == State::getPlayer()->getPlayable())
     173        State::getGameRules()->onPlayerDeath();
     174
     175      Explosion::explode(dynamic_cast<PNode*>(this), Vector(1.0f, 1.0f, 1.0f));
    187176//     this->toList(OM_GROUP_05);
    188177  //HACK: moves the entity to an unknown place far far away: in the future, GameRules will look for that
    189     this->setAbsCoor(-2000.0, -2000.0, -2000.0);
     178      this->setAbsCoor(-2000.0, -2000.0, -2000.0);
    190179
    191180  //explosion hack
    192     this->emitter->setSystem(explosionParticles);
    193     this->emitter->setSystem(NULL);
     181
     182    }
     183    this->bDead = true;
    194184  }
    195185}
  • trunk/src/world_entities/playable.h

    r7092 r7118  
    1818class Player;
    1919class SpriteParticles;
     20class Explosion;
    2021
    2122//! Basic controllable WorldEntity
     
    9091    int                   oldScore;
    9192
     93    bool                  bDead;
     94
    9295    //TODO HACK: explosion emitter
    93     DotEmitter*           emitter;
    94     SpriteParticles*      explosionParticles;
     96
    9597
    9698    WorldEntity* collider;
Note: See TracChangeset for help on using the changeset viewer.