Exemple #1
0
        public static void DrawBuddy(RectangleF boundary, float bodyRotation, float rotLeg, bool walking, bool vest, Vector2 velocity, CollisionResolver resolver)
        {
            Game1.SpriteBatchGlobal.Draw(Game1.playerTex, new Vector2((float)Math.Round(boundary.Position.X), (float)Math.Round(boundary.Position.Y)) + new Vector2(24, 62), rotation: bodyRotation, origin: new Vector2(12 * 2, 31 * 2));

            if (vest == true)
            {
                Game1.SpriteBatchGlobal.Draw(Game1.Textures["PlayerVest"], new Vector2((float)Math.Round(boundary.Position.X), (float)Math.Round(boundary.Position.Y)) + new Vector2(24, 62), rotation: bodyRotation, origin: new Vector2(12 * 2, 31 * 2));
            }

            Vector2 rightLegJoin = boundary.Origin + new Vector2(+12, +50);
            Vector2 leftLegJoin  = boundary.Origin + new Vector2(-12, +50);

            if (walking == true)
            {
                if (velocity.X - resolver.VelocityReceived.X < 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(10f * 2, 5 * 2), effects: SpriteEffects.FlipHorizontally);
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(10f * 2, 5 * 2), effects: SpriteEffects.FlipHorizontally);
                }
                if (velocity.X - resolver.VelocityReceived.X > 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(2 * 2f, 5 * 2));
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(2f * 2, 5 * 2));
                }
            }
            else
            {
                if (resolver.TouchTop == false && resolver.TouchTopMovable == false)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footAir, new Vector2((float)Math.Round(leftLegJoin.X), (float)Math.Round(leftLegJoin.Y)), origin: new Vector2(4.5f * 2, 5 * 2));
                    Game1.SpriteBatchGlobal.Draw(Game1.footAir, new Vector2((float)Math.Round(rightLegJoin.X), (float)Math.Round(rightLegJoin.Y)), origin: new Vector2(4.5f * 2, 5 * 2));
                }
                else
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.foot, new Vector2((float)Math.Round(leftLegJoin.X), (float)Math.Round(leftLegJoin.Y + 8)), origin: new Vector2(4.5f * 2, 5 * 2));
                    Game1.SpriteBatchGlobal.Draw(Game1.foot, new Vector2((float)Math.Round(rightLegJoin.X), (float)Math.Round(rightLegJoin.Y + 8)), origin: new Vector2(4.5f * 2, 5 * 2));
                }
            }
        }
Exemple #2
0
        public static void DrawZombie(bool walking, CollisionResolver resolver, float bodyRotation, RectangleF boundary, float rotLeg, Vector2 velocity)
        {
            Game1.SpriteBatchGlobal.Draw(Game1.zombie, boundary.Position + new Vector2(24, 62), rotation: bodyRotation, origin: new Vector2(11, 31));

            Vector2 rightLegJoin = boundary.Origin + new Vector2(+12, +50);
            Vector2 leftLegJoin  = boundary.Origin + new Vector2(-12, +50);

            if (walking == true)
            {
                if (velocity.X < 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(10f, 5), effects: SpriteEffects.FlipHorizontally);
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(10f, 5), effects: SpriteEffects.FlipHorizontally);
                }
                if (velocity.X > 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(2f, 5));
                    Game1.SpriteBatchGlobal.Draw(Game1.footWalk, new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(2f, 5));
                }
            }
            else
            {
                if (resolver.TouchBottom == false && resolver.TouchTopMovable == false)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.footAir, new Vector2((float)Math.Round(leftLegJoin.X), (float)Math.Round(leftLegJoin.Y)), origin: new Vector2(4.5f, 5));
                    Game1.SpriteBatchGlobal.Draw(Game1.footAir, new Vector2((float)Math.Round(rightLegJoin.X), (float)Math.Round(rightLegJoin.Y)), origin: new Vector2(4.5f, 5));
                }
                else
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.foot, new Vector2((float)Math.Round(leftLegJoin.X), (float)Math.Round(leftLegJoin.Y + 8)), origin: new Vector2(4.5f, 5));
                    Game1.SpriteBatchGlobal.Draw(Game1.foot, new Vector2((float)Math.Round(rightLegJoin.X), (float)Math.Round(rightLegJoin.Y + 8)), origin: new Vector2(4.5f, 5));
                }
            }
        }
Exemple #3
0
        public static void DrawMech(RectangleF boundary, float rotLeg, bool walking, Vector2 velocity, CollisionResolver resolver, float walkSin, mechFacingLegs facingLegs, mechFacingCabin facingCabin)
        {
            Vector2 rightLegJoin = boundary.Origin + new Vector2(+12 + 16, +42);
            Vector2 leftLegJoin  = boundary.Origin + new Vector2(-12 - 16, +42);

            float jumpJoints = 4;

            if (walking == true)
            {
                if (velocity.X < 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                }
                if (velocity.X > 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2));
                }
            }
            else
            {
                if (resolver.TouchBottom == true || resolver.TouchTopMovable == true)
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], rightLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], leftLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
                else
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], rightLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechLeftLeg"], leftLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
            }

            if (facingCabin == mechFacingCabin.right)
            {
                Game1.SpriteBatchGlobal.Draw(texture: Game1.Textures["MechBody"], position: boundary.Position + new Vector2(0, (int)Math.Round((float)(Math.Sin(walkSin)))));
            }
            if (facingCabin == mechFacingCabin.left)
            {
                Game1.SpriteBatchGlobal.Draw(texture: Game1.Textures["MechBody"], position: boundary.Position + new Vector2(0, (int)Math.Round((float)Math.Sin(walkSin))), effects: SpriteEffects.FlipHorizontally);
            }

            if (walking == true)
            {
                if (velocity.X < 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg + (float)Math.PI, rightLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                }
                if (velocity.X > 0)
                {
                    Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], new Vector2((float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 7), new Vector2(0), rotLeg, leftLegJoin).X), (float)Math.Round(CompareF.OriginRotateOffset(new Vector2(0, 8), new Vector2(0), rotLeg, leftLegJoin).Y)), origin: new Vector2(18.5f * 2, 12 * 2));
                }
            }
            else
            {
                if (resolver.TouchBottom == true || resolver.TouchTopMovable == true)
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], leftLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], rightLegJoin + new Vector2(0, 7), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
                else
                {
                    if (facingLegs == mechFacingLegs.right)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], leftLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2));
                    }
                    if (facingLegs == mechFacingLegs.left)
                    {
                        Game1.SpriteBatchGlobal.Draw(Game1.Textures["MechRightLeg"], rightLegJoin - new Vector2(0, jumpJoints), origin: new Vector2(18.5f * 2, 12 * 2), effects: SpriteEffects.FlipHorizontally);
                    }
                }
            }
        }