Exemplo n.º 1
0
        private static PhysicalVector2 GetStartingPosition(
            Physical.PosRectangle playerPosRectangle,
            Physical.Orientation.Cardinal orientation,
            Physical.Rectangle rectangle
            )
        {
            PhysicalVector2 result =
                playerPosRectangle.GetCenteredBound(orientation);

            switch (orientation)
            {
            case Physical.Orientation.Cardinal.Left:
                result.X -= (rectangle.Width / 2);
                break;

            case Physical.Orientation.Cardinal.Right:
                result.X += (rectangle.Width / 2);
                break;

            case Physical.Orientation.Cardinal.Up:
                result.Y -= (rectangle.Height / 2);
                break;

            case Physical.Orientation.Cardinal.Down:
                result.Y += (rectangle.Height / 2);
                break;
            }

            return(result);
        }
Exemplo n.º 2
0
 private static void ChangeVelocity(
     Comps.Velocity velocity,
     Orientation.Cardinal direction,
     float moveSpeed
     )
 {
     velocity.data  = direction.GetPhysicalVector2() * moveSpeed;
     velocity.decay = 1;
 }