Exemplo n.º 1
0
        public void Update(GameTime gameTime)
        {
            KeyboardObject.Update();
            MouseObject.Update();
            Vector2 movement = Vector2.Zero;

            if (state == HeroState.ISBLINK)
            {
                _blinktime += gameTime.ElapsedGameTime.TotalSeconds;
                if (_blinktime >= 1.0f)
                {
                    state      = HeroState.NORMAL;
                    _blinktime = 0.0f;
                }
            }

            UpdateKyeboardAndMouce(ref movement);
            CheckCanMove();

            _sprite.Position += movement;
            UpdateRay(movement);

            UpdateAnimation(gameTime);

            _weapon.SetRotation(MouseObject.Position + (Camera2D.GetInstance().Position - new Vector2(600, 450)));
            _weapon.Updata();
            _sprite.Update();
        }
Exemplo n.º 2
0
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            mouse.Update();
            keyboard.Update();

            HandleInput(keyboard.Key(Keys.LeftShift) ? WriteMode.Tone : WriteMode.Wall);

            if (!keyboard.Key(Keys.P))
            {
                simulator.Simulate(1f / 30, keyboard.Key(Keys.O) ? 1 : 60);
            }

            base.Update(gameTime);
        }