Example #1
0
 /// <summary>
 ///   Handle a collision between this component's owner sprite and a tile.
 /// </summary>
 /// <param name="collidingTile">
 ///   The tile that the owner sprite has collided with.
 /// </param>
 /// <param name="resolutionDistance">
 ///   The distance by which the owner sprite was moved to resolve the collision.
 /// </param>
 public override void HandleTileCollision(Tile collidingTile, Vector2 resolutionDistance)
 {
     if (resolutionDistance.GetResolutionDirection() == Direction.Right && Direction == Direction.Left)
     {
         Direction = Direction.Right;
         CurrentVelocity = -CurrentVelocity;
     }
     else if (resolutionDistance.GetResolutionDirection() == Direction.Left && Direction == Direction.Right)
     {
         Direction = Direction.Left;
         CurrentVelocity = -CurrentVelocity;
     }
 }