Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 19, 2006, 8:00:52 PM (17 years ago)
Author:
nicolasc
Message:

some beautifications, nothing new

File:
1 edited

Legend:

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

    r10035 r10104  
    153153
    154154
    155 void Projectile::collidesWith (SpaceShip* target, const Vector& location)
     155void Projectile::collidesWith (WorldEntity* target, const Vector& location)
    156156{
    157   target->damage(this->physDamage, this->elecDamage);
     157  dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage());
     158//   this->destroy(NULL);
    158159  this->destroy(target);
    159160}
    160161
    161 
    162 /**
    163  *  this function gets called by tick to calculate the new flight direction
    164  *  @param curDirection direction vector
    165  *  @param estTargetDir target vector, pointing to where the target will be on hit
    166  *  @param angle = tick * turningSpeed
    167  *  @return normalized (new) direction vector
    168 */
    169 // Vector Projectile::newDirection(Vector curDirection, Vector estTargetDir, float angle)
    170 // {
    171 //   float tmp = angleDeg ( curDirection, estTargetDir);
    172 //   if ( unlikely(tmp == 0) ) { return curDirection; }
    173 //
    174 //   if( fabsf(angle) >  fabsf(tmp) ) { angle = tmp; }
    175 //
    176 //   Vector d = curDirection.cross(estTargetDir).cross(curDirection);
    177 //   d.normalize();
    178 //   if( unlikely( angle == 90)) { return d; }
    179 //
    180 //   Vector newDir = curDirection + d *  curDirection.len() * tan (angle);
    181 //   newDir.normalize();
    182 //   return newDir;
    183 // }
    184162
    185163
     
    190168void Projectile::tick (float dt)
    191169{
    192 /*
    193   if (target != NULL){
    194     float tti = this->target->getRelCoor().len() / this->getVelocity().len();
    195     Vector estTargetDir = (this->target->getRelCoor() + this->target->getVelocity()) * tti;
    196     this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * dt ) * this->velocity.len();
    197     Vector v = this->velocity * (dt);
    198     this->shiftCoor(v);
    199   }*/
    200 
    201170  if (this->tickLifeCycle(dt))
    202171    this->destroy( NULL );
Note: See TracChangeset for help on using the changeset viewer.