Follow-up Comment #2, bug #6933 (project wormux):

I think we could try this kind of code in Character to avoid this issue :

// Signal a collision with another object (overlapse ?)
void Character::SignalObjectCollision(PhysicalObj * obj)
{
  PhysicalObj * right_object = this;
  PhysicalObj * left_object = obj;
  // X Overlapse ?
  if (this->GetX() < obj->GetX()) {
    right_object = obj;
    left_object = this;
  }
  int width = left_object->GetTestWidth();
  if (left_object->GetX() + width > right_object->GetX()) {
    int left_move = (int)(width/2);
    int right_move = width - left_move;
    left_object->SetX(left_object->GetX() - left_move);
    right_object->SetX(right_object->GetX() - right_move);
  }
  // TODO : the same with Y overlapse.
}


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?6933>

_______________________________________________
  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