Ejemplo n.º 1
0
 public void Shoot(GameTime gameTime)
 {
     if (gameTime.TotalGameTime - previousFireTime > fireRate)
     {
         if (GamePad.GetState(playerNumber).Triggers.Right >= 0.5f)
         {
             Projectile projectile = new Projectile();
             projectileAnimation = new Animation();
             projectileAnimation.LoadTexture(projectileTex);
             projectileAnimation.Initialize(1, 1, shootPosition, 0, Color.White);
             previousFireTime = gameTime.TotalGameTime;
             projectile.Initialize(projectileAnimation, shootPosition,shootSpeed, shootAngle, damage);
             Game1.projectiles.Add(projectile);
         }
     }
 }
Ejemplo n.º 2
0
 public void LoadPlayers()
 {
     players = new List<Player>();
     for (int i = 0; i < noPlayers; i++)
     {     playerBody = new Animation();
         playerHead = new Animation();
         playerArm = new Animation();
         playerRunning = new Animation();
         playerJump = new Animation();
         playerWalking = new Animation();
         playerCrouch = new Animation();
         weaponAnimation = new Animation();
         bulletAnimation = new Animation();
         playerBody.LoadTexture(playerBodyTex);
         playerRunning.LoadTexture(playerRunningTex);
         playerHead.LoadTexture(playerHeadTex);
         playerArm.LoadTexture(playerArmTex);
         playerJump.LoadTexture(playerJumpTex);
         playerCrouch.LoadTexture(playerCrouchTex);
         playerWalking.LoadTexture(playerWalkingTex);
         weaponAnimation.LoadTexture(weaponTex);
         
        Weapon weapon = new Weapon();
        weapon.Initialize(weaponAnimation, bulletTex, new Vector2(0, 0), new Vector2(10, 0), new Vector2(6, 14), 0, true, 1f, TimeSpan.FromSeconds(0.3), 10, (PlayerIndex)i);
         Player player = new Player();
         player.Initialize(healthTexture,playerBody, playerRunning, playerWalking, playerCrouch, playerJump, playerHead, playerArm,
           new Vector2(random.Next(1920), random.Next(1080)), graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height,
             new Vector2(0, 40f), 200, new Vector2(0, 15), (PlayerIndex)i, 0, hatTexs[playerHatNums[i]], hatPos[playerHatNums[i]]);
         player.activeWeapon = weapon;
         players.Add(player);
     }
 }
Ejemplo n.º 3
0
        public void InitializeSelectScreen()
        {
           
            readyPlayers = 0;
            readyPlayerChecker = new List<bool>();
            readyPlayerChecker.Add(false);
            readyPlayerChecker.Add(false);
            readyPlayerChecker.Add(false);

            readyPlayerChecker.Add(false);
            selectHats = new List<Animation>();
            selectIconsBody = new List<Animation>();
            selectIconsHead = new List<Animation>();
            selectIcon = new Animation();
            selectIcon.LoadTexture(playerBodyTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth / 5, graphics.PreferredBackBufferHeight * 2 / 3), 0, Color.White);
            selectIconsBody.Add(selectIcon);
            selectIcon = new Animation();
            selectIcon.LoadTexture(playerBodyTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth*2 / 5, graphics.PreferredBackBufferHeight *2/ 3), 0, Color.White);
            selectIconsBody.Add(selectIcon);
            selectIcon = new Animation();
            selectIcon.LoadTexture(playerBodyTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth * 3 / 5, graphics.PreferredBackBufferHeight * 2 / 3), 0, Color.White);
            selectIconsBody.Add(selectIcon);
            selectIcon = new Animation();
            selectIcon.LoadTexture(playerBodyTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth * 4 / 5, graphics.PreferredBackBufferHeight * 2 / 3), 0, Color.White);
            selectIconsBody.Add(selectIcon);

            selectIcon = new Animation();
            selectIcon.LoadTexture(playerHeadTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth / 5, graphics.PreferredBackBufferHeight * 2 / 3 - playerHeadTex.Height / 2 - playerBodyTex.Height / 2), 0, Color.White);
            selectIconsHead.Add(selectIcon);
            selectIcon = new Animation();
            selectIcon.LoadTexture(playerHeadTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth * 2 / 5, graphics.PreferredBackBufferHeight * 2 / 3 - playerHeadTex.Height / 2 - playerBodyTex.Height / 2), 0, Color.White);
            selectIconsHead.Add(selectIcon);
            selectIcon = new Animation();
            selectIcon.LoadTexture(playerHeadTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth * 3 / 5, graphics.PreferredBackBufferHeight * 2 / 3 - playerHeadTex.Height / 2 - playerBodyTex.Height / 2), 0, Color.White);
            selectIconsHead.Add(selectIcon);
            selectIcon = new Animation();
            selectIcon.LoadTexture(playerHeadTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth * 4 / 5, graphics.PreferredBackBufferHeight * 2 / 3 - playerHeadTex.Height / 2 - playerBodyTex.Height / 2), 0, Color.White);
            selectIconsHead.Add(selectIcon);

            selectIcon = new Animation();
            selectIcon.LoadTexture(playerHeadTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth / 5, graphics.PreferredBackBufferHeight * 2 / 3 - playerBodyTex.Height / 2), 0, Color.White);
            selectHats.Add(selectIcon);
            selectIcon = new Animation();
            selectIcon.LoadTexture(playerHeadTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth * 2 / 5, graphics.PreferredBackBufferHeight * 2 / 3 - playerBodyTex.Height / 2), 0, Color.White);
            selectHats.Add(selectIcon);
            selectIcon = new Animation();
            selectIcon.LoadTexture(playerHeadTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth * 3 / 5, graphics.PreferredBackBufferHeight * 2 / 3 - playerBodyTex.Height / 2), 0, Color.White);
            selectHats.Add(selectIcon);
            selectIcon = new Animation();
            selectIcon.LoadTexture(playerHeadTex);
            selectIcon.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth * 4 / 5, graphics.PreferredBackBufferHeight * 2 / 3 - -playerBodyTex.Height / 2), 0, Color.White);
            selectHats.Add(selectIcon);

        }
Ejemplo n.º 4
0
  public static void AddPickupPlayerDeath(float x,float y, Vector2 vel,Vector2 vel2)
  {
      Pickup pickup = new Pickup();
      pickupAnimation = new Animation();
      pickupAnimation.LoadTexture(pickupTex);
      pickup.Initialize(pickupAnimation, new Vector2(x, y), vel, vel2, 10);
 
      pickups.Add(pickup);
  }
Ejemplo n.º 5
0
        public static void RespawnPlayer(int playerNum)
        {
            int score = players[playerNum].score;
            playerBody = new Animation();
            playerHead = new Animation();
            playerArm = new Animation();
            playerRunning = new Animation();
            playerJump = new Animation();
            playerWalking = new Animation();
            playerCrouch = new Animation();
            weaponAnimation = new Animation();
            bulletAnimation = new Animation();
            playerBody.LoadTexture(playerBodyTex);
            playerRunning.LoadTexture(playerRunningTex);
            playerHead.LoadTexture(playerHeadTex);
            playerArm.LoadTexture(playerArmTex);
            playerJump.LoadTexture(playerJumpTex);
            playerCrouch.LoadTexture(playerCrouchTex);
            playerWalking.LoadTexture(playerWalkingTex);

            weaponAnimation.LoadTexture(weaponTex);
            Weapon weapon = new Weapon();
            weapon.Initialize(weaponAnimation, bulletTex, new Vector2(0, 0), new Vector2(10, 0), new Vector2(6, 14), 0, true, 1f, TimeSpan.FromSeconds(0.3), 10, (PlayerIndex)playerNum);
             
            players[playerNum] = new Player();
            players[playerNum].Initialize(healthTexture, playerBody, playerRunning, playerWalking, playerCrouch, playerJump, playerHead, playerArm,
                   new Vector2(random.Next(1920), random.Next(1080)), graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height,
                    new Vector2(0, 40f), 200, new Vector2(0, 15), (PlayerIndex)playerNum, score, hatTexs[playerHatNums[playerNum]], hatPos[playerHatNums[playerNum]]);
            players[playerNum].activeWeapon = weapon;
        }
Ejemplo n.º 6
0
 public void AddPickup()
 {
     Pickup pickup = new Pickup();
     pickupAnimation = new Animation();
     switch (random.Next(1, 5))
     {
         case 1:
             pickupTex = clockTex;
             break;
         case 2:
             pickupTex = noteTex;
             break;
         case 3:
             pickupTex = coinsTex;
             break;
         case 4:
             pickupTex = piggybankTex;
             break;
     }
     pickupAnimation.LoadTexture(pickupTex);
     pickup.Initialize(pickupAnimation, new Vector2(random.Next(1920), random.Next(1080)), new Vector2(0, 40f),new Vector2 (0,0), 10);
     pickups.Add(pickup);
 }
Ejemplo n.º 7
0
 public void StartGame()
 {
     HatLoad();
     currentGameLength = TimeSpan.FromSeconds(0);
     projectiles = new List<Projectile>();
     playerBody = new Animation();
     playerHead = new Animation();
     playerArm = new Animation();
     playerRunning = new Animation();
     playerJump = new Animation();
     playerWalking = new Animation();
     playerCrouch = new Animation();
     weaponAnimation = new Animation();
     bulletAnimation = new Animation();
     platformAnimation = new Animation();
     backGroundAnimation = new Animation();
     scoreAnimation = new Animation();
     platformRectangles = new List<Rectangle>();
     pickups = new List<Pickup>();
     stairRectangles = new List<Rectangle>();
     scoreAnimation.LoadTexture(scoreTex);
     backGroundAnimation.LoadTexture(backGroundTex);
     scoreAnimation.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth / 2, 0), 0, Color.White);
    
     backGroundAnimation.Initialize(1, 1, new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2), 0, Color.White);
     LoadPlayers();
     AddPlatform();
     AddStairs();
 }
Ejemplo n.º 8
0
        public void HatLoad()
        {
         hatsHats = new List<List<Animation>>();
                 hatTexs = new List<Texture2D>() ;
                 hats = new List<Animation>();
                 hatPos = new List<Vector2>();
                 Texture2D hatTexture = LoadContent(this.Content, "ricehat");
                 hatTexs.Add(hatTexture);

                 hatPos.Add(new Vector2(8, 10));
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatTexture = LoadContent(this.Content, "boater");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(15, 8));
                 hatTexture = LoadContent(this.Content, "chefhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 1));
                 hatTexture = LoadContent(this.Content, "christmashat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 5));
                 hatTexture = LoadContent(this.Content, "dmed");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 6));
                 hatTexture = LoadContent(this.Content, "elfhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(18, 3));
                 hatTexture = LoadContent(this.Content, "fez");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(19, 3));
                 hatTexture = LoadContent(this.Content, "vikinghat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(13, 4));

                 hatTexture = LoadContent(this.Content, "pilgrimmhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(18, 4));

                 hatTexture = LoadContent(this.Content, "piratehat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(11, 7));

                 hatTexture = LoadContent(this.Content, "russianhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(13, 11));
                 hatTexture = LoadContent(this.Content, "stetson");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(12, 0));
                 hatTexture = LoadContent(this.Content, "wizardhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(17, 2));
                 hatsHats.Add(hats);

                 hatTexs = new List<Texture2D>();
                 hats = new List<Animation>();
                 hatPos = new List<Vector2>();
                 hatTexture = LoadContent(this.Content, "ricehat");
                 hatTexs.Add(hatTexture);

                 hatPos.Add(new Vector2(8, 10));
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatTexture = LoadContent(this.Content, "boater");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(15, 8));
                 hatTexture = LoadContent(this.Content, "chefhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 1));
                 hatTexture = LoadContent(this.Content, "christmashat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 5));
                 hatTexture = LoadContent(this.Content, "dmed");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 6));
                 hatTexture = LoadContent(this.Content, "elfhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(18, 3));
                 hatTexture = LoadContent(this.Content, "fez");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(19, 3));
                 hatTexture = LoadContent(this.Content, "vikinghat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(13, 4));

                 hatTexture = LoadContent(this.Content, "pilgrimmhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(18, 4));

                 hatTexture = LoadContent(this.Content, "piratehat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(11, 7));

                 hatTexture = LoadContent(this.Content, "russianhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(13, 11));
                 hatTexture = LoadContent(this.Content, "stetson");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(12, 0));
                 hatTexture = LoadContent(this.Content, "wizardhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(17, 2));
                 hatsHats.Add(hats);

                 hatTexs.Add(hatTexture);
                 hatTexs = new List<Texture2D>();
                 hats = new List<Animation>();
                 hatPos = new List<Vector2>();
                  hatTexture = LoadContent(this.Content, "ricehat");
                 hatTexs.Add(hatTexture);

                 hatPos.Add(new Vector2(8, 10));
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
              
                 hatTexture = LoadContent(this.Content, "boater");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(15, 8));
                 hatTexture = LoadContent(this.Content, "chefhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 1));
                 hatTexture = LoadContent(this.Content, "christmashat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 5));
                 hatTexture = LoadContent(this.Content, "dmed");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 6));
                 hatTexture = LoadContent(this.Content, "elfhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(18, 3));
                 hatTexture = LoadContent(this.Content, "fez");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(19, 3));
                 hatTexture = LoadContent(this.Content, "vikinghat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(13, 4));

                 hatTexture = LoadContent(this.Content, "pilgrimmhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(18, 4));

                 hatTexture = LoadContent(this.Content, "piratehat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(11, 7));

                 hatTexture = LoadContent(this.Content, "russianhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(13, 11));
                 hatTexture = LoadContent(this.Content, "stetson");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(12, 0));
                 hatTexture = LoadContent(this.Content, "wizardhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(17, 2));

                 hatsHats.Add(hats);
                 hatTexs.Add(hatTexture);
                 hatTexs = new List<Texture2D>();
                 hats = new List<Animation>();
                 hatPos = new List<Vector2>();
                 hatTexture = LoadContent(this.Content, "ricehat");
                 hatTexs.Add(hatTexture);
                 hatPos.Add(new Vector2(8, 10));

                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatTexture = LoadContent(this.Content, "boater");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(15, 8));
                 hatTexture = LoadContent(this.Content, "chefhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 1));
                 hatTexture = LoadContent(this.Content, "christmashat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 5));
                 hatTexture = LoadContent(this.Content, "dmed");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(14, 6));
                 hatTexture = LoadContent(this.Content, "elfhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(18, 3));
                 hatTexture = LoadContent(this.Content, "fez");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(19, 3));
                 hatTexture = LoadContent(this.Content, "vikinghat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(13, 4));

                 hatTexture = LoadContent(this.Content, "pilgrimmhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(18, 4));

                 hatTexture = LoadContent(this.Content, "piratehat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(11, 7));

                 hatTexture = LoadContent(this.Content, "russianhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(13, 11));
                 hatTexture = LoadContent(this.Content, "stetson");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(12, 0));
                 hatTexture = LoadContent(this.Content, "wizardhat");
                 hatTexs.Add(hatTexture);
                 hat = new Animation();
                 hat.LoadTexture(hatTexture);
                 hats.Add(hat);
                 hatPos.Add(new Vector2(17, 2));

                 hatsHats.Add(hats);


        }
Ejemplo n.º 9
0
        public void InitializeMainMenu()
        {
            playButtonAnimation = new Animation();
            playButtonAnimation.LoadTexture(playButtonTex);
            exitButtonAnimation = new Animation();
            exitButtonAnimation.LoadTexture(exitButtonTex);
            menuButtons = new List<Button>();

            
            Button button = new Button();
            button.Initialize(new Vector2((1920) / 2, 500 + 140 / 2), playButtonAnimation, "play", 1);
            menuButtons.Add(button);

            button = new Button();
            button.Initialize(new Vector2((1920) / 2, 700 + 140 / 2), exitButtonAnimation, "exit", 2);
            menuButtons.Add(button);
        }
Ejemplo n.º 10
0
 public void Initialize(Texture2D healthtexture,Animation playerBody, Animation playerRunning, Animation playerWalking, Animation playerCrouch, Animation playerJump, Animation playerHead, Animation playerArm, Vector2 position, float windowWidth, float windowHeight, Vector2 gravity,
   float playerSpeed, Vector2 jumpSpeed, PlayerIndex playerNumber, int score,Texture2D hatTex, Vector2 hatPos )
 {
     this.hatAnimation =new Animation();
     this.healthtexture = healthtexture;
     this.hatPos = hatPos;
     State currentState = State.OnGround;
     MoveState currentMoveState = MoveState.Standing;
     active = true;
     this.score = score;
     health = 100;
     this.playerWalking = playerWalking;
     this.playerCrouch = playerCrouch;
     this.playerJump = playerJump;
     this.playerRunning = playerRunning;
     this.jumpSpeed = jumpSpeed;
     this.gravity = gravity;
     this.playerNumber = playerNumber;
     this.playerSpeed = playerSpeed;
     this.playerBody = playerBody;
     this.playerHead = playerHead;
     this.playerArm = playerArm;
     this.position = position;
     this.windowWidth = windowWidth;
     this.windowHeight = windowHeight;
     headPosition = new Vector2(position.X, position.Y - (playerBody.frameHeight + playerHead.frameHeight) / 2);
     armPosition = new Vector2(position.X, position.Y - (playerBody.frameHeight) / 2);
     playerBody.Initialize(1, 1, position, 0, Color.White);
     playerWalking.Initialize(20, 0.5f, position, 0, Color.White);
     playerRunning.Initialize(20, 0.4f, position, 0, Color.White);
     playerJump.Initialize(true, 5,0.2f, position, 0, Color.White);
     playerCrouch.Initialize(true, 5, 0.2f, position, 0, Color.White);
     playerRunning.active = false;
     playerCrouch.active = false;
     playerJump.active = false;
     playerWalking.active = false;
     playerHead.Initialize(1, 1, headPosition, 0, Color.White);
     playerArm.Initialize(1, 1, armPosition, 0, Color.White);
     mainHitbox = new Rectangle((int)position.X - playerBody.frameWidth / 2, (int)position.Y - playerBody.frameHeight / 2, playerBody.frameWidth, playerBody.frameHeight);
     headHitbox = new Rectangle((int)headPosition.X - playerHead.frameWidth / 2, (int)headPosition.Y - playerHead.frameHeight / 2, playerHead.frameWidth, playerHead.frameHeight);
     footBox = new Rectangle((int)position.X - playerBody.frameWidth / 2, (int)position.Y + playerBody.frameHeight / 2 -10, playerBody.frameWidth, 10);
     jumpList.Add(26);
     jumpList.Add(22);
     jumpList.Add(16);
     jumpList.Add(9);
     jumpList.Add(0);
     activeAnimation = playerBody;
     hatAnimation.LoadTexture(hatTex);
     hatAnimation.Initialize(1, 1, new Vector2(0, 0), 0, Color.White);
 }