public override void Update(GameTime gametime, Microsoft.Xna.Framework.Input.KeyboardState kbstate, Microsoft.Xna.Framework.Input.MouseState moustate)
        {
            this._Model.Update(gametime, kbstate, moustate);

            if(kbstate.IsKeyDown(Keys.A))
            {
                //this._Model.PlayClip(FLY_IDLE);
            }
            else if (kbstate.IsKeyDown(Keys.S))
            {
                this._Model.PlayClip(GROUND_IDLE, true);
            }
        }
Пример #2
0
 public override bool Control( GameEntity control, TimeSpan gameTime, Microsoft.Xna.Framework.Input.KeyboardState keyState )
 {
     if ( control == Owner && Owner.IsAlive && keyState.IsKeyDown( Owner.Keys.KeyShoot ) && ( lastShot == TimeSpan.Zero || ( gameTime - lastShot ).TotalMilliseconds > speed ) )
     {
         Owner.Shoot( gameTime );
         lastShot = gameTime;
     }
     return base.Control( control, gameTime, keyState );
 }
Пример #3
0
 public void Update(InGame world, Microsoft.Xna.Framework.Input.KeyboardState ks)
 {
     //Checking for input.
     if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left) && (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right)))
     {
     }
     else if ((ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left)) && (PositionX > 0))
     {
         PositionX -= Speed;
         //The paddle can't go off the left side of the screen.
         if (PositionX < 0)
             PositionX = 0;
     }
     else if ((ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right))&& (PositionX < Breakout.StageWidth - Width))
     {
         PositionX += Speed;
         //The paddle can't go beyond the right side of the stage.
         if (PositionX > Breakout.StageWidth - Width)
             //If we try, We are set next to the edge.
             PositionX = Breakout.StageWidth - Width;
     }
 }
Пример #4
0
        public void HandleInput(Microsoft.Xna.Framework.Input.KeyboardState keyboardState, Raquette _Raquette)
        {
            if (keyboardState.IsKeyDown(Keys.Space) && !_Launched && _StartTimer <= 0.0f)
            {
                _Launched = true;
            }

            if (keyboardState.IsKeyDown(Keys.Space) && _Stuck)
            {
                _Stuck = false;
                PositionY = _Raquette.Position.Y - 20;
                Speed = 0.5f;
            }

            //Si la balle est stuck tant que la balle reste dans le cadre on la fait bouger avec la raquette
            if (((keyboardState.IsKeyDown(Keys.Left) && (Position.X > _Viewport.X)) || (keyboardState.IsKeyDown(Keys.Right) && (Position.X + Texture.Width) < (_Viewport.Width + _Viewport.X) )) && _Stuck)
            {
                PositionX = _Raquette.PositionX + _DistanceFromRaquette;
            }
        }
Пример #5
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Input.KeyboardState keyboard, Microsoft.Xna.Framework.Input.MouseState mouse)
 {
     if (findingNetwork)
     {
         if (introTime > 8.1f) introTime -= (float)gameTime.ElapsedGameTime.TotalSeconds * 4;
         networkTime -= (float)gameTime.ElapsedGameTime.TotalSeconds;
         if (networkTime < lastNetTime)
         {
             lastNetTime--;
             Network.FindServer();
             if (Network.IsConnected)
                 Login();
         }
         if (networkTime <= 0)
         {
             findingNetwork = false;
             lastNetTime = 10;
             netFailString = "No Network Found.";
         }
     }
     else
     {
         introTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
         if (networkTime < 10)
             networkTime += (float)gameTime.ElapsedGameTime.TotalSeconds * 2;
     }
     if (introTime < 0 && introTime > -1)
         MobileFortressClient.Game.Exit();
     if (introTime > 8)
     {
         Manager.Update(gameTime,mouse);
         if (keyboard.IsKeyDown(Keys.Enter))
         {
             if (!loginMenuScroll)
                 loginButton.DoClick();
             else
                 loginConfirmButton.DoClick();
         }
     }
     else
     {
         if (keyboard.IsKeyDown(Keys.Escape) || keyboard.IsKeyDown(Keys.Enter))
             introTime = 8;
     }
     Viewport viewport = MobileFortressClient.Game.GraphicsDevice.Viewport;
     if (loginMenuScroll)
     {
         Color disabledColor = new Color(96, 64, 64);
         loginButton.canClick = false;
         loginButton.color = Color.Lerp(loginButton.color, disabledColor, 0.3f);
         optionsButton.canClick = false;
         optionsButton.color = Color.Lerp(optionsButton.color, disabledColor, 0.3f);
         exitButton.canClick = false;
         exitButton.color = Color.Lerp(exitButton.color, disabledColor, 0.3f);
         if (scrolledAmt < loginMenu.Height)
         {
             foreach (UIElement element in Manager.Elements)
             {
                 element.dimensions.Y -= 4;
             }
             scrolledAmt += 4;
         }
         loginDimensions.Y = viewport.Height - scrolledAmt;
     }
     else
     {
         loginButton.canClick = true;
         loginButton.color = Color.Lerp(loginButton.color, Color.LightGray, 0.3f);
         optionsButton.canClick = true;
         optionsButton.color = Color.Lerp(optionsButton.color, Color.LightGray, 0.3f);
         exitButton.canClick = true;
         exitButton.color = Color.Lerp(exitButton.color, Color.LightGray, 0.3f);
         if (scrolledAmt > 0)
         {
             foreach (UIElement element in Manager.Elements)
             {
                 element.dimensions.Y += 4;
             }
             scrolledAmt -= 4;
         }
         loginDimensions.Y = viewport.Height - scrolledAmt;
     }
 }
Пример #6
0
		private void OnGameBaseKeyPress(Keys[] keys, Microsoft.Xna.Framework.Input.KeyboardState state)
		{
			if (state.IsKeyDown(Keys.F12))
			{
				IsGameRunning = false;
				Exit();
			}
			else if (keys.Length > 0)
			{
				OnKeyPress(keys, state);
			}
		}
 internal static bool shouldSnapRotation(Microsoft.Xna.Framework.Input.KeyboardState kstate)
 {
     return !kstate.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl);
 }
 internal static bool shouldSnapPosition(Microsoft.Xna.Framework.Input.KeyboardState kstate)
 {
     //This patch enables free positioning (ignore grid) when left control is held
     return (Constants.Instance.SnapToGrid && !kstate.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl));
 }
Пример #9
0
        public void HandleInput(Microsoft.Xna.Framework.Input.KeyboardState keyboardState, ContentManager content)
        {
            if (keyboardState.IsKeyDown(Keys.Left) && Position.X > _Viewport.X)
            {
                PositionX -= Speed * ElapsedTime;
            }

            if (keyboardState.IsKeyDown(Keys.Right) && (Position.X + (Texture.Width * _SizeScale)) < _Viewport.Width + _Viewport.X)
            {
                PositionX += Speed * ElapsedTime;
            }

            BulletsTimer += ElapsedTime;

            if (_ListeBonus.ContainsKey(BonusType.Bullets) && keyboardState.IsKeyDown(Keys.A) && BulletsTimer >= 200.0f)
            {
                BulletsTimer = 0;

                Bullets BulletGauche = new Bullets(BulletsSide.Left);
                Bullets BulletDroite = new Bullets(BulletsSide.Right);

                _ListeBullets.Add(BulletGauche);
                _ListeBullets.Add(BulletDroite);

                BulletGauche.LoadContent(content, "Bullets");
                BulletDroite.LoadContent(content, "Bullets");

                BulletGauche.Initialize(_Viewport, this);
                BulletDroite.Initialize(_Viewport, this);
            }
        }