Exemplo n.º 1
0
        public void Update()
        {
            if (Mouse.GetState().RightButton == ButtonState.Pressed)
            {
                game.Exit();
            }
            if (Mouse.GetState().LeftButton == ButtonState.Pressed)
            {
                float x = Mouse.GetState().X;
                float y = Mouse.GetState().Y;

                if (x < 400 && y < 200)
                {
                    game.sprite = new StandingSprite(game.standing, 1, 1);
                }
                else if (x < 400 && y > 200)
                {
                    game.sprite = new MovingSprite(game.dead, 1, 1);
                }
                else if (x > 400 && y < 200)
                {
                    game.sprite = new AnimatedSprite(game.running, 1, 3);
                }
                else if (x > 400 && y > 200)
                {
                    game.sprite = new RunandMoveSprite(game.running, 1, 3);
                }
            }
        }
Exemplo n.º 2
0
 public void Update()
 {
     if (Keyboard.GetState().IsKeyDown(Keys.NumPad0) || Keyboard.GetState().IsKeyDown(Keys.D0))
     {
         game.Exit();
     }
     else if (Keyboard.GetState().IsKeyDown(Keys.NumPad1) || Keyboard.GetState().IsKeyDown(Keys.D1))
     {
         game.sprite = new StandingSprite(game.standing, 1, 1);
     }
     else if (Keyboard.GetState().IsKeyDown(Keys.NumPad2) || Keyboard.GetState().IsKeyDown(Keys.D2))
     {
         game.sprite = new AnimatedSprite(game.running, 1, 3);
     }
     else if (Keyboard.GetState().IsKeyDown(Keys.NumPad3) || Keyboard.GetState().IsKeyDown(Keys.D3))
     {
         game.sprite = new MovingSprite(game.dead, 1, 1);
     }
     else if (Keyboard.GetState().IsKeyDown(Keys.NumPad4) || Keyboard.GetState().IsKeyDown(Keys.D4))
     {
         game.sprite = new RunandMoveSprite(game.running, 1, 3);
     }
 }