示例#1
0
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = Game.Services.GetService <SpriteBatch>();

            if (SolidCollisionSide.HasFlag(CollisionDirection.Bottom) && Speed.Y >= 0)
            {
                if (Speed.X != 0)
                {
                    animationSheet.CycleIndex = 1;
                }
                else
                {
                    animationSheet.CycleIndex = 0;
                }
            }
            else
            {
                animationSheet.CycleIndex = 2;
            }

            animationSheet.DestinationRectangle = Rectangle;
            animationSheet.Draw(gameTime);
        }
示例#2
0
 protected bool CanJump()
 {
     return(Speed.Y == 0 &&
            SolidCollisionSide.HasFlag(CollisionDirection.Bottom) &&
            !SolidCollisionSide.HasFlag(CollisionDirection.Top));
 }