Example #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            font1 = Content.Load<SpriteFont>("Fonts/MyFont");

            leo = new Player("Leo1");
            taskMaster = new Boss_TaskMaster();

            leo.AddSprite(Animation.State.STANCE, new Sprite("Sprites/Actors/Leo/Stance"));
            leo.SetFrameDelay(Animation.State.STANCE, 5);


            leo.AddSprite(Animation.State.WALK_TOWARDS, new Sprite("Sprites/Actors/Leo/Walk", Animation.Type.REPEAT));
            leo.SetSpriteOffSet(Animation.State.WALK_TOWARDS, 0, 240f);

            leo.AddSprite(Animation.State.JUMP_START, new Sprite("Sprites/Actors/Leo/JumpStart", Animation.Type.ONCE));
            leo.SetSpriteOffSet(Animation.State.JUMP_START, 20, 10);
            leo.SetFrameDelay(Animation.State.JUMP_START, 5);

            leo.AddSprite(Animation.State.LAND, new Sprite("Sprites/Actors/Leo/Land", Animation.Type.ONCE));
            leo.SetSpriteOffSet(Animation.State.LAND, 30, -11);
            leo.SetFrameDelay(Animation.State.LAND, 5);

            leo.AddSprite(Animation.State.JUMP, new Sprite("Sprites/Actors/Leo/Jump", Animation.Type.REPEAT, 13));
            leo.SetFrameDelay(Animation.State.JUMP, 5);
            leo.SetSpriteOffSet(Animation.State.JUMP, 10, -80);

            leo.AddSprite(Animation.State.JUMP_TOWARDS, new Sprite("Sprites/Actors/Leo/JumpTowards", Animation.Type.REPEAT, 13));
            leo.SetFrameDelay(Animation.State.JUMP_TOWARDS, 5);
            leo.SetFrameDelay(Animation.State.JUMP_TOWARDS, 1, 6);
            leo.SetSpriteOffSet(Animation.State.JUMP_TOWARDS, 10, -80);

            leo.AddAnimationLink(new Animation.Link(Animation.State.JUMP_START, Animation.State.JUMP, leo.GetSprite(Animation.State.JUMP_START).GetFrames()));
            leo.SetTossFrame(Animation.State.JUMP, 1);
            leo.SetTossFrame(Animation.State.JUMP_TOWARDS, 1);

            leo.AddSprite(Animation.State.FALL1, new Sprite("Sprites/Actors/Leo/Falling", Animation.Type.REPEAT, 5));
            leo.SetSpriteOffSet(Animation.State.FALL1, 10, -80);

            leo.SetAnimationState(Animation.State.STANCE);
            
            
            leo.SetSpriteOffSet(Animation.State.WALK_TOWARDS, 30, -5);
            leo.SetResetFrame(Animation.State.WALK_TOWARDS, 3);
            leo.SetMoveFrame(Animation.State.WALK_TOWARDS, 3);
            leo.SetHeight(180);

            leo.SetFrameDelay(Animation.State.WALK_TOWARDS, 5);
            leo.SetFrameDelay(Animation.State.WALK_TOWARDS, 1, 6);
            leo.SetFrameDelay(Animation.State.WALK_TOWARDS, 2, 6);
            leo.SetFrameDelay(Animation.State.WALK_TOWARDS, 3, 6);

            leo.AddSprite(Animation.State.ATTACK1, new Sprite("Sprites/Actors/Leo/Attack1", Animation.Type.ONCE));
            leo.SetSpriteOffSet(Animation.State.ATTACK1, 40, -35);
            leo.SetFrameDelay(Animation.State.ATTACK1, 4);
            leo.SetFrameDelay(Animation.State.ATTACK1, 1, 5);
            leo.SetFrameDelay(Animation.State.ATTACK1, 2, 5);

            leo.AddBox(Animation.State.ATTACK1, 6, new CLNS.AttackBox(100, 80, 132, 45));
            //leo.GetAttackBox(Animation.State.ATTACK1, 6).SetComboStep(0);

            leo.AddBox(Animation.State.ATTACK1, 6, new CLNS.AttackBox(100, 80, 59, 99, 1));
            leo.AddBox(Animation.State.ATTACK1, 6, new CLNS.AttackBox(100, 80, 159, 99, 1));
            //leo.GetAttackBox(Animation.State.ATTACK1, 6).SetComboStep(1);

            leo.AddBox(Animation.State.ATTACK1, 7, new CLNS.AttackBox(150, 50, -10, 210, 1));
            leo.AddBox(Animation.State.ATTACK1, 7, new CLNS.AttackBox(150, 50, -60, 160, 1));
            leo.GetAttackBox(Animation.State.ATTACK1, 7).SetComboStep(0);


            leo.AddSprite(Animation.State.ATTACK2, new Sprite("Sprites/Actors/Leo/Attack2", Animation.Type.ONCE));
            leo.SetSpriteOffSet(Animation.State.ATTACK2, 25, -37);
            leo.SetFrameDelay(Animation.State.ATTACK2, 4);
            leo.AddBox(Animation.State.ATTACK2, 6, new CLNS.AttackBox(220, 230, 20, 30));
            leo.AddBox(Animation.State.ATTACK2, 6, new CLNS.AttackBox(220, 230, 20, 30));
            leo.AddBox(Animation.State.ATTACK2, 6, new CLNS.AttackBox(220, 230, 20, 30));

            leo.AddSprite(Animation.State.ATTACK3, new Sprite("Sprites/Actors/Leo/Attack3", Animation.Type.ONCE));
            leo.SetSpriteOffSet(Animation.State.ATTACK3, 60, -10);
            leo.SetFrameDelay(Animation.State.ATTACK3, 4);
            leo.AddBox(Animation.State.ATTACK3, 6, new CLNS.AttackBox(220, 230, 20, 30));
            leo.AddBox(Animation.State.ATTACK3, 6, new CLNS.AttackBox(220, 230, 20, 30));
            leo.AddBox(Animation.State.ATTACK3, 5, new CLNS.AttackBox(220, 230, 20, 30));

            leo.AddSprite(Animation.State.ATTACK4, new Sprite("Sprites/Actors/Leo/Attack4", Animation.Type.ONCE));
            leo.SetSpriteOffSet(Animation.State.ATTACK4, 30, 3);
            leo.SetFrameDelay(Animation.State.ATTACK4, 4);
            leo.AddBox(Animation.State.ATTACK4, 3, new CLNS.AttackBox(220, 230, 20, 30));
            leo.AddBox(Animation.State.ATTACK4, 5, new CLNS.AttackBox(220, 230, 20, 30));

            leo.AddSprite(Animation.State.ATTACK5, new Sprite("Sprites/Actors/Leo/Attack5", Animation.Type.ONCE));
            leo.SetSpriteOffSet(Animation.State.ATTACK5, 50, -25);
            leo.SetFrameDelay(Animation.State.ATTACK5, 4);
            leo.AddBox(Animation.State.ATTACK5, 6, new CLNS.AttackBox(220, 230, 20, 30));
            leo.AddBox(Animation.State.ATTACK5, 6, new CLNS.AttackBox(220, 230, 20, 30));

            leo.AddSprite(Animation.State.ATTACK6, new Sprite("Sprites/Actors/Leo/Attack6", Animation.Type.ONCE), true);
            leo.SetSpriteOffSet(Animation.State.ATTACK6, 35, -41);
            leo.SetFrameDelay(Animation.State.ATTACK6, 4);
            leo.AddBox(Animation.State.ATTACK6, 5, new CLNS.AttackBox(220, 230, 20, 30));
            leo.AddBox(Animation.State.ATTACK6, 6, new CLNS.AttackBox(220, 230, 20, 30));
            leo.AddBox(Animation.State.ATTACK6, 5, new CLNS.AttackBox(220, 230, 20, 30));
            leo.AddBox(Animation.State.ATTACK6, 5, new CLNS.AttackBox(220, 230, 20, 30));

            leo.AddSprite(Animation.State.JUMP_ATTACK1, new Sprite("Sprites/Actors/Leo/JumpAttack1", Animation.Type.ONCE), true);
            leo.SetSpriteOffSet(Animation.State.JUMP_ATTACK1, 60, -70);
            leo.SetFrameDelay(Animation.State.JUMP_ATTACK1, 4);
            leo.SetFrameDelay(Animation.State.JUMP_ATTACK1, 1, 4);
            leo.SetFrameDelay(Animation.State.JUMP_ATTACK1, 2, 4);

            leo.AddSprite(Animation.State.JUMP_TOWARD_ATTACK1, new Sprite("Sprites/Actors/Leo/JumpAttack2", Animation.Type.ONCE), true);
            leo.SetSpriteOffSet(Animation.State.JUMP_TOWARD_ATTACK1, 30, -60);
            leo.SetFrameDelay(Animation.State.JUMP_TOWARD_ATTACK1, 4);
            leo.SetFrameDelay(Animation.State.JUMP_TOWARD_ATTACK1, 1, 4);
            leo.SetFrameDelay(Animation.State.JUMP_TOWARD_ATTACK1, 2, 4);

            leo.SetTossFrame(Animation.State.JUMP_ATTACK1, 1);
            leo.SetTossFrame(Animation.State.JUMP_TOWARD_ATTACK1, 1);

            leo.AddSprite(Animation.State.JUMP_RECOVER1, new Sprite("Sprites/Actors/Leo/JumpRecover1", Animation.Type.REPEAT, 3));
            leo.SetSpriteOffSet(Animation.State.JUMP_RECOVER1, 20, -80);
            leo.SetFrameDelay(Animation.State.JUMP_RECOVER1, 5);
            leo.SetFrameDelay(Animation.State.JUMP_RECOVER1, 1, 6);
            leo.SetFrameDelay(Animation.State.JUMP_RECOVER1, 2, 6);

            leo.AddAnimationLink(new Animation.Link(Animation.State.JUMP_ATTACK1, Animation.State.JUMP_RECOVER1, 8));
            leo.AddAnimationLink(new Animation.Link(Animation.State.JUMP_TOWARD_ATTACK1, Animation.State.JUMP_RECOVER1, 9));

            leo.SetDefaultAttackChain(new ComboAttack.Chain(new List<ComboAttack.Move>{
                new ComboAttack.Move(Animation.State.ATTACK1, 222000, 7),
                new ComboAttack.Move(Animation.State.ATTACK1, 222000, 7),
                new ComboAttack.Move(Animation.State.ATTACK1, 222000, 7)/*,
                new ComboAttack.Move(Animation.State.ATTACK4, 222000, 4),
                new ComboAttack.Move(Animation.State.ATTACK4, 222000, 4),
                new ComboAttack.Move(Animation.State.ATTACK4, 222000, 4),
                new ComboAttack.Move(Animation.State.ATTACK2, 222000, 8),
                new ComboAttack.Move(Animation.State.ATTACK3, 222000, 7),
                new ComboAttack.Move(Animation.State.ATTACK3, 222000, 7),
                new ComboAttack.Move(Animation.State.ATTACK3, 222000, 7),
                new ComboAttack.Move(Animation.State.ATTACK5, 222000, 7),
                new ComboAttack.Move(Animation.State.ATTACK6, 222000, 8)*/
            }));

            /*leo.SetFrameDelay(Animation.State.ATTACK1, 1);
            leo.SetFrameDelay(Animation.State.ATTACK2, 1);
            leo.SetFrameDelay(Animation.State.ATTACK3, 1);
            leo.SetFrameDelay(Animation.State.ATTACK4, 1);
            leo.SetFrameDelay(Animation.State.ATTACK5, 1);
            leo.SetFrameDelay(Animation.State.ATTACK6, 1);*/

            leo.AddBoundsBox(new CLNS.BoundsBox(125, 283, -30, 80, 40));
            leo.SetScale(1.6f, 2.2f);
            leo.SetPostion(400, 0, 200);


            drum = new Entity(Entity.EntityType.OBSTACLE, "DRUM1");
            drum.AddSprite(Animation.State.STANCE, new Sprite("Sprites/Misc/Drum"));
            drum.SetAnimationState(Animation.State.STANCE);
            //drum.AddBox(new CLNS.BoundingBox(CLNS.BoxType.BODY_BOX, 125, 210, -30, 80));
            drum.AddBoundsBox(new CLNS.BoundsBox(125, 210, -30, 80, 20));
            drum.SetScale(2.2f, 2.6f);
            drum.SetPostion(700, 0, 200);
            drum.SetSpriteOffSet(Animation.State.STANCE, 32, 90);
            drum.SetDepthOffset(-5);
            drum.SetDepth(20);
            drum.SetHeight(170);
            drum.SetWidth(125);

            drum2 = new Entity(Entity.EntityType.OBSTACLE, "DRUM2");
            drum2.AddSprite(Animation.State.STANCE, new Sprite("Sprites/Misc/Drum"));
            drum2.SetAnimationState(Animation.State.STANCE);
            drum2.AddBox(new CLNS.BoundingBox(CLNS.BoxType.BODY_BOX, 125, 210, -30, 80));
            drum2.AddBoundsBox(new CLNS.BoundsBox(125, 210, -30, 80, 20));
            drum2.SetScale(2.2f, 2.6f);

            drum2.SetPostion(500, 0, 200);
            drum2.SetSpriteOffSet(Animation.State.STANCE, 32, 90);
            drum2.SetDepthOffset(-5);
            drum2.SetDepth(20);
            drum2.SetHeight(170);
            drum2.SetWidth(125);

            drum3 = new Entity(Entity.EntityType.OBSTACLE, "DRUM3");
            drum3.AddSprite(Animation.State.STANCE, new Sprite("Sprites/Misc/Drum"));
            drum3.SetAnimationState(Animation.State.STANCE);
            drum3.AddBox(new CLNS.BoundingBox(CLNS.BoxType.BODY_BOX, 125, 210, -30, 80));
            drum3.AddBoundsBox(new CLNS.BoundsBox(125, 210, -30, 80, 20));
            drum3.SetScale(2.2f, 2.6f);
            drum3.SetPostion(290, -180, 200);
            drum3.SetGroundBase(-180);
            drum3.SetSpriteOffSet(Animation.State.STANCE, 32, 90);
            drum3.SetDepthOffset(-5);
            drum3.SetDepth(20);
            drum3.SetHeight(170);
            drum3.SetWidth(125);

            drum4 = new Entity(Entity.EntityType.OBSTACLE, "DRUM4");
            drum4.AddSprite(Animation.State.STANCE, new Sprite("Sprites/Misc/Drum"));
            drum4.SetAnimationState(Animation.State.STANCE);

            drum4.AddBox(new CLNS.BoundingBox(CLNS.BoxType.BODY_BOX, 125, 210, -30, 80));
            drum4.AddBoundsBox(new CLNS.BoundsBox(125, 210, -30, 80, 20));

            drum4.SetScale(2.2f, 2.6f);
            drum4.SetPostion(1200, -320, 200);
            drum4.SetGroundBase(-320);
            drum4.SetSpriteOffSet(Animation.State.STANCE, 32, 90);
            drum4.SetDepthOffset(-5);
            drum4.SetDepth(20);
            drum4.SetHeight(170);
            drum4.SetWidth(125);

            drum4.SetDimension(125, 170);
            drum3.SetDimension(125, 170);
            drum2.SetDimension(125, 170);
            drum.SetDimension(125, 170);

            /*hitSpark1 = new Entity(Entity.EntityType.OTHER, "SPARK1");
            hitSpark1.AddSprite(Animation.State.STANCE, new Sprite("Sprites/Actors/Leo/Spark1", Animation.Type.REPEAT));
            hitSpark1.SetAnimationState(Animation.State.STANCE);
            hitSpark1.SetFrameDelay(Animation.State.STANCE, 40);
            hitSpark1.SetScale(1.2f, 1.2f);
            hitSpark1.SetPostion(600, 0, 400);
            hitSpark1.SetFade(225);*/

            
            leo.SetScale(1.8f, 2.6f);
            leo.SetHeight(180);

            level1 = new Stage1();
            bar = new LifeBar(0, 0);

            renderManager = new RenderManager();
            renderManager.AddEntity(leo);
            renderManager.AddEntity(taskMaster);
            /*renderManager.AddEntity(drum);
            renderManager.AddEntity(drum2);
            renderManager.AddEntity(drum3);
            renderManager.AddEntity(drum4);
            renderManager.AddLevel(level1);
            *///renderManager.AddEntity(hitSpark1);

            collisionManager = new CollisionManager(renderManager);
            collisionManager.AddEntity(leo);
            //collisionManager.AddEntity(leo2);
            /*collisionManager.AddEntity(drum);
            collisionManager.AddEntity(drum2);
            collisionManager.AddEntity(drum3);
            collisionManager.AddEntity(drum4);
            */

            command = new InputHelper.CommandMove("TEST", Animation.State.ATTACK6, new List<InputHelper.KeyState>
            {
                new InputHelper.KeyState(InputHelper.KeyPress.A | InputHelper.KeyPress.X, InputHelper.ButtonState.Pressed),
                new InputHelper.KeyState(InputHelper.KeyPress.RIGHT, InputHelper.ButtonState.Held, (float)9, 30),
                new InputHelper.KeyState(InputHelper.KeyPress.RIGHT, InputHelper.ButtonState.Released, 30),
                new InputHelper.KeyState(InputHelper.KeyPress.RIGHT, InputHelper.ButtonState.Released, 30),
                new InputHelper.KeyState(InputHelper.KeyPress.RIGHT, InputHelper.ButtonState.Pressed),
                new InputHelper.KeyState(InputHelper.KeyPress.RIGHT, InputHelper.ButtonState.Released)
            });

            leo.AddCommandMove(command);
            leo.SetAnimationState(Animation.State.STANCE);
            leo.SetBaseOffset(-60, -30f);
            //control = new InputControl(leo, PlayerIndex.One);

            inputManager = new InputManager();
            inputManager.AddControl(leo, PlayerIndex.One);

            // TODO: use this.Content to load your game content here
        }