Пример #1
0
        public Player(int startpos, Healthbar bar, List <Texture2D> JKickAnimations, List <Texture2D> JPunchAnimations, Song KickSound, PlayerInput Input, int groundline, int breed, int hoog, List <Texture2D> IdleAnimations, List <Texture2D> WalkAnimations, List <Texture2D> WalkBAnimations, List <Texture2D> JumpAnimations, List <Texture2D> PunchAnimations, List <Texture2D> KickAnimations, List <Texture2D> DuckAnimations)
        {
            this.IdleAnimations   = IdleAnimations;
            this.WalkAnimations   = WalkAnimations;
            this.WalkBAnimations  = WalkBAnimations;
            this.JumpAnimations   = JumpAnimations;
            this.PunchAnimations  = PunchAnimations;
            this.KickAnimations   = KickAnimations;
            this.DuckAnimations   = DuckAnimations;
            this.JKickAnimations  = JKickAnimations;
            this.JPunchAnimations = JPunchAnimations;
            this.healthbar        = bar;

            this.Movement  = Input;
            this.Frame     = IdleAnimations[0];
            this.KickSound = KickSound;

            this.Height     = hoog;
            this.Width      = breed;
            this.groundline = groundline;
            this.MoveSpeed  = Convert.ToInt16(Height / 108);

            this.oldState    = Keyboard.GetState(); // dit word alleen in die UpdateInput() gebruikt
            this.oldPadState = GamePad.GetState(PlayerIndex.One);


            this.y             = groundline; // de begin Y pos van de speler.... dit moet echt een class in...
            this.x             = startpos;   // the hardcode is real... CLASSES
            this.jumpbool      = false;      // dit gaat echt te ver... maar het werk :/
            this.vel           = 0;
            this.Idleloop      = 0;          // stil staan animatie
            this.Walkloop      = 0;
            this.Kickloop      = 0;
            this.Punchloop     = 0;
            this.Jumploop      = 0;
            this.Animationloop = 0;
        }
Пример #2
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font        = Content.Load <SpriteFont>("File");

            // laad de sprite
            KickSound = Content.Load <Song>("Whoosh");

            for (int i = 0; i < 28; ++i)
            {
                FlyThing.Add(Content.Load <Texture2D>(("F" + Convert.ToString(100 + i))));
            }
            for (int i = 0; i < 8; ++i)
            {
                DuckAnimations.Add(Content.Load <Texture2D>(("DUCK" + Convert.ToString(i + 1))));
            }
            for (int i = 0; i < 4; ++i)
            {
                JPunchAnimations.Add(Content.Load <Texture2D>(("Jpunch" + Convert.ToString(i + 1))));
            }
            JPunchAnimations.Add(Content.Load <Texture2D>(("Jpunch4")));
            JPunchAnimations.Add(Content.Load <Texture2D>(("Jpunch4")));
            for (int i = 0; i < 7; ++i)
            {
                JKickAnimations.Add(Content.Load <Texture2D>(("JKICK" + Convert.ToString(i + 1))));
            }
            for (int i = 0; i < 13; ++i)
            {
                KickAnimations.Add(Content.Load <Texture2D>(("KICK" + Convert.ToString(i + 1))));
            }
            for (int i = 0; i < 10; ++i)
            {
                JumpAnimations.Add(Content.Load <Texture2D>(("JUMP" + Convert.ToString(i + 1))));
            }
            for (int i = 0; i < 11; ++i)
            {
                WalkAnimations.Add(Content.Load <Texture2D>(("WALK" + Convert.ToString(i + 1))));
            }
            for (int i = 0; i < 11; ++i)
            {
                WalkBAnimations.Add(Content.Load <Texture2D>(("WALKB" + Convert.ToString(i + 1))));
            }
            for (int i = 0; i < 9; ++i)
            {
                PunchAnimations.Add(Content.Load <Texture2D>(("PUNCH" + Convert.ToString(i + 1))));
            }
            for (int i = 0; i < 10; ++i)
            {
                IdleAnimations.Add(Content.Load <Texture2D>(("IDLE" + Convert.ToString(i + 1))));
            }

            BG1 = Content.Load <Texture2D>("BG1");
            BG2 = Content.Load <Texture2D>("BG2");
            BG3 = Content.Load <Texture2D>("BG3");
            BG4 = Content.Load <Texture2D>("BG4");
            BG5 = Content.Load <Texture2D>("BG5");
            BG6 = Content.Load <Texture2D>("BG6");
            BG7 = Content.Load <Texture2D>("BG7");
            BG8 = Content.Load <Texture2D>("BG8");


            barplayer1 = new Healthbar(font, Height, Width, "left");
            barplayer2 = new Healthbar(font, Height, Width, "right");


            background      = new Background(BG1, BG2, BG3, BG4, BG5, BG6, BG7, BG8, Width, Height);
            Player2Movement = new PlayerInput(Keys.Right, Keys.Left, Keys.Down, Keys.Up, Keys.O, Keys.P, PlayerIndex.One);
            Player1Movement = new PlayerInput(Keys.D, Keys.A, Keys.S, Keys.W, Keys.C, Keys.V, PlayerIndex.Two);
            player1         = new Player(100, barplayer1, JKickAnimations, JPunchAnimations, KickSound, Player1Movement, groundline, Width, Height, IdleAnimations, WalkAnimations, WalkBAnimations, JumpAnimations, PunchAnimations, KickAnimations, DuckAnimations);
            player2         = new Player(Width - 100, barplayer2, JKickAnimations, JPunchAnimations, KickSound, Player2Movement, groundline, Width, Height, IdleAnimations, WalkAnimations, WalkBAnimations, JumpAnimations, PunchAnimations, KickAnimations, DuckAnimations);
            floot           = new FloatingMan(Height, Width, FlyThing, font);
            gamestate       = new Gamestate(background, player1, player2, floot);
        }