Пример #1
0
 static void Main()
 {
     using (var game = new TestGame())
         game.Run();
 }
Пример #2
0
        public override void Update(Game game)
        {
            base.Update(game);

            TestGame g = (TestGame)game;

            if (game.Keyboard.IsKeyDown(Key.S))
            {
                sound.Play();
            }

            if (game.Keyboard.IsAnyKeyDown(Key.Q, Key.Left))
            {
                x          -= (float)(speed * game.Time.Elapsed);
                g.camera.x -= (float)(speed * game.Time.Elapsed);

                if (switcher)
                {
                    tex = textures[4];
                }
                else
                {
                    tex = textures[5];
                }
            }

            if (game.Keyboard.IsAnyKeyDown(Key.D, Key.Right))
            {
                x          += (float)(speed * game.Time.Elapsed);
                g.camera.x += (float)(speed * game.Time.Elapsed);

                if (switcher)
                {
                    tex = textures[0];
                }
                else
                {
                    tex = textures[1];
                }
            }

            if (game.Keyboard.IsAnyKeyDown(Key.Z, Key.Up))
            {
                y          -= (float)(speed * game.Time.Elapsed);
                g.camera.y -= (float)(speed * game.Time.Elapsed);

                if (switcher)
                {
                    tex = textures[2];
                }
                else
                {
                    tex = textures[3];
                }
            }

            if (game.Keyboard.IsAnyKeyDown(Key.S, Key.Down))
            {
                y          += (float)(speed * game.Time.Elapsed);
                g.camera.y += (float)(speed * game.Time.Elapsed);

                if (switcher)
                {
                    tex = textures[6];
                }
                else
                {
                    tex = textures[7];
                }
            }

            c += game.Time.Elapsed;

            if (c > changer)
            {
                c        = 0;
                switcher = !switcher;
            }

            text.Update(g);
        }