Follow-up Comment #10, task #5925 (project wormux):

You are right, I didn't get the wanted effect. If you want to get some
additional speed you need to multiply the mass by ten time before starting to
get something interesting.

Here's the code I have tried :
void WeaponBullet::SignalObjectCollision(PhysicalObj * obj, const Point2d&
my_speed_before)
{
  // multiply by ten to get something more funny
  double bullet_mass = GetMass()/* * 10*/;
  double total_mass = bullet_mass + obj->GetMass();
  // computing new speed of character
  Point2d v2 = (my_speed_before * (1 + 0.8) * bullet_mass +
                obj->GetSpeed() * (obj->GetMass() - 0.8 * bullet_mass)) /
total_mass;
  // Pushing a little upward character to allow him to be pushed by the
projectile
  obj->SetXY(Point2i(obj->GetX(), obj->GetY() - 3));
  obj->SetSpeedXY(v2);
  obj->SetEnergyDelta(-(int)cfg.damage);
  if (!obj->IsCharacter())
    Explosion();
  Ghost();
}

    _______________________________________________________

Reply to this item at:

  <http://gna.org/task/?5925>

_______________________________________________
  Message posté via/par Gna!
  http://gna.org/


_______________________________________________
Wormux-gna mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-gna

Reply via email to