This commit is contained in:
parent
6358c9f570
commit
152f1fc93c
1 changed files with 23 additions and 0 deletions
|
@ -222,6 +222,29 @@ void CNpcConveyorPlatform::collidedWith( CThing *_thisThing )
|
||||||
|
|
||||||
m_contact = true;
|
m_contact = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int distLeft, distRight;
|
||||||
|
|
||||||
|
DVECTOR playerCollisionSize = player->getCollisionSize();
|
||||||
|
|
||||||
|
distLeft = collisionArea.x1 - playerPos.vx - ( playerCollisionSize.vx >> 1 );
|
||||||
|
distRight = collisionArea.x2 - playerPos.vx + ( playerCollisionSize.vx >> 1 );
|
||||||
|
|
||||||
|
DVECTOR playerShove;
|
||||||
|
playerShove.vy = 0;
|
||||||
|
|
||||||
|
if ( abs( distLeft ) < abs( distRight ) )
|
||||||
|
{
|
||||||
|
playerShove.vx = distLeft;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playerShove.vx = distRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
player->shove( playerShove );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue