Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 20, 2006, 12:31:27 AM (17 years ago)
Author:
marcscha
Message:

Last update, collision working again. SEGFAULT problems

File:
1 edited

Legend:

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

    r10113 r10117  
    5353  this->setMinEnergy(4);
    5454  this->setHealthMax(0);
    55   this->lifeSpan = 5.0;
     55  this->lifeSpan = 3.0;
    5656  this->angle     = 0;
    5757
     
    137137  this->lifeCycle = 0.0;
    138138
    139   //this->toList(OM_NULL);
    140139  this->toList(OM_DEAD);
    141   //this->removeNode();
     140  this->removeNode();
    142141  MBolt::fastFactory->kill(this);
    143142}
     
    146145void MBolt::collidesWith(WorldEntity* entity, const Vector& location)
    147146{
    148   PRINTF(0)("MBolt collides pretest\n");
    149 
    150   if( entity == NULL)
     147
     148  if (this->hitEntity != entity)
     149    this->destroy( entity );
     150  this->hitEntity = entity;
     151  dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage());
     152  this->destroy(this);
     153 
     154  return;
     155
     156  if( entity == NULL || dynamic_cast<SpaceShip*>(entity) == NULL)
    151157    return;
    152158
    153   PRINTF(0)("MBolt collides\n");
    154159  dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage());
    155160  //entity->destroy(this);
     
    179184void MBolt::destroy (WorldEntity* killer)
    180185{
     186  //this->deactivate();
    181187  Projectile::destroy( killer );
    182188  PRINTF(5)("DESTROY MBolt\n");
     
    211217
    212218}
    213 
Note: See TracChangeset for help on using the changeset viewer.