Beispiel #1
0
        protected override void Update(GameTime gameTime)
        {
            TesteMapa.update(gameTime);
            Input.Update();
            MIRA.update();
            MouseState mState = Mouse.GetState();

            Camera.Focus = MIRA;
            mousevector  = new Vector2(mState.X, mState.Y);
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            if (Input.IsPressed(Keys.K))
            {
                //CameraFocusAux++;
                //if (CameraFocusAux > CharactersHandler.Players.Count-1) CameraFocusAux = 0;
                //Camera.Focus = CharactersHandler.Players[CameraFocusAux];
                CharactersHandler.ChangeActive();
            }
            CharactersHandler.updatePlayers(gameTime);
            //Player1.Update(gameTime);
            //Player2.Update(gameTime);
            base.Update(gameTime);
        }
Beispiel #2
0
 public void Draw(SpriteBatch spriteBatch, Characters ActiveChar)
 {
     spriteBatch.Draw(this.textura, new Vector2(ActiveChar.CharacterPosition().X + helperXCharPos + 10, ActiveChar.CharacterPosition().Y + 45), null, Color.White, this.rotation + (float)Math.PI / 2, new Vector2((float)45 + helperX, (float)40), 1f, flip, 0f);
     spriteBatch.DrawString(font, "Weapon Name: " + CharactersHandler.getActiveWeapon().getName(), new Vector2(500f, 500f), Color.White);
     spriteBatch.DrawString(font, "Weapon Type: " + CharactersHandler.getActiveWeapon().getWeaponType(), new Vector2(500f, 525f), Color.White);
     spriteBatch.DrawString(font, "test\nPress 1 - first weapon", new Vector2(200f, 550f), Color.White);
     spriteBatch.DrawString(font, "Press 2 - second weapon", new Vector2(200f, 600f), Color.White);
     spriteBatch.DrawString(font, "Press 3 - Third weapon", new Vector2(200f, 625f), Color.White);
     foreach (Bullet bullet in bulletsOnScreen)
     {
         if (bullet.ammoType == Bullet.AmmoType.cal32)
         {
             if (fireRateTime < ammunition.getFireRate(Bullet.AmmoType.cal32))
             {
                 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------pus este 260 a sorte e deu GG--------------------
                 spriteBatch.Draw(flashFiring[currentFrame], new Vector2(this.PositionRelativeToCharacter.X + 5 + helperXpos, this.PositionRelativeToCharacter.Y + 45), null, Color.White, rotation, new Vector2((float)0, (float)260), .15f, SpriteEffects.None, 0f);
             }
             spriteBatch.Draw(texturax, new Vector2(bullet.sourcePosition.X, bullet.sourcePosition.Y + 10), null, Color.White, rotation, new Vector2((float)5, (float)2.5), 1f, SpriteEffects.None, 0f);
         }
         else if (bullet.ammoType == Bullet.AmmoType.rocket)
         {
             spriteBatch.Draw(texturasRocket, new Vector2(bullet.sourcePosition.X, bullet.sourcePosition.Y + 7), null, Color.White, rotation, new Vector2((float)5, (float)3.5), 1f, SpriteEffects.None, 0f);
         }
         else if (bullet.ammoType == Bullet.AmmoType.nade)
         {
         }
     }
     if (Sexplosion)
     {
         spriteBatch.Draw(explosion[currentFrame1], new Vector2(Bullet.rec.X, Bullet.rec.Y), null, Color.White, 0f, new Vector2((float)5, (float)5), 0.05f, SpriteEffects.None, 0f);
     }
     Sexplosion = false;
     //spriteBatch.Draw(flatSquare, new Vector2(PositionRelativeToCharacter.X + helperXCharPos, PositionRelativeToCharacter.Y + helperYCharPos), Color.White);
 }
Beispiel #3
0
 protected override void Update(GameTime gameTime)
 {
     Input.Update();
     if (gameState == GameState.Menu)
     {
         MenusHandler.Update(gameTime, this);
     }
     else
     {
         roundTime -= (float)gameTime.ElapsedGameTime.TotalSeconds;
         TesteMapa.update(gameTime);
         MouseState mState = Mouse.GetState();
         mousevector = new Vector2(mState.X, mState.Y);
         if (Keyboard.GetState().IsKeyDown(Keys.Escape))
         {
             gameState = GameState.Paused;
         }
         if (Input.IsPressed(Keys.K) && Player1.isJumping() == false && Player2.isJumping() == false)
         {
             CharactersHandler.ChangeActive();
         }
         if (roundTime <= 0)
         {
             CharactersHandler.ChangeActive();
             roundTime = 20;
         }
         CharactersHandler.updatePlayers(gameTime);
     }
     base.Update(gameTime);
 }
Beispiel #4
0
 protected override void LoadContent()
 {
     Camera.Scale = 0.7f;
     TesteMapa    = new Map();
     TesteMapa.Load(Content);
     TesteMapa.InitRectMap();
     spriteBatch = new SpriteBatch(GraphicsDevice);
     MIRA        = new Crosshair();
     MIRA.Load(Content);
     CharactersHandler.InitList(Content);
     Player1 = CharactersHandler.getCharacter(0);
     Player1.SetCharacterInPlay();
     Player2 = CharactersHandler.getCharacter(1);
     Player1.SetCharacterPosition(new Vector2(600, 350));
     Player1.Load(Content);
     Collisions.characterCollisions.Add(Player1);
     Player2.SetCharacterPosition(new Vector2(700, 350));
     Player2.Load(Content);
     Collisions.characterCollisions.Add(Player2);
     CharactersHandler.AddPlayer(Player1);
     CharactersHandler.AddPlayer(Player2);
 }