Esempio n. 1
0
 /// <summary>
 /// The Game entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Esempio n. 2
0
        public void KeyboardInput(Player player, NewLevel level, Game1 game)
        {

            KeyboardState newState = Keyboard.GetState();

        
            if (Keyboard.GetState().IsKeyDown(Keys.W) || Keyboard.GetState().IsKeyDown(Keys.Up))
                {
                    player.Accelerate(level.cam.ScrollSpeed);
                //    level.backgroundVector = Vector2.Add(level.backgroundVector, new Vector2(0, (float)Math.Exp(level.cam.ScrollSpeed)));
                }
            if (Keyboard.GetState().IsKeyDown(Keys.A) || Keyboard.GetState().IsKeyDown(Keys.Left))
                {
                player.Rotation -= 0.1f;
                //level.backgroundVector = Vector2.Add(level.backgroundVector, new Vector2((float)Math.Exp(level.cam.ScrollSpeed), 0));
                }
            if (Keyboard.GetState().IsKeyDown(Keys.S) || Keyboard.GetState().IsKeyDown(Keys.Down))
            {
                player.Deccelerate(level.cam.ScrollSpeed);
                //    level.backgroundVector = Vector2.Add(level.backgroundVector, new Vector2(0, -(float)Math.Exp(level.cam.ScrollSpeed)));
            }

            if (Keyboard.GetState().IsKeyDown(Keys.D) || Keyboard.GetState().IsKeyDown(Keys.Right))
            {
                // level.backgroundVector = Vector2.Add(level.backgroundVector, new Vector2(-(float)Math.Exp(level.cam.ScrollSpeed), 0));
                player.Rotation += 0.1f;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Q))
            {
                if (level.cam.Zoom != 10f && level.cam.ScrollSpeed > 1f)
                {
                    level.cam.ScrollSpeed -= 0.06F;
                    level.cam.Zoom += 0.01F;
                }

            }
            if (Keyboard.GetState().IsKeyDown(Keys.E))
            {

                if (level.cam.Zoom != 0.01f && level.cam.ScrollSpeed < 100f)
                {
                    level.cam.ScrollSpeed += 0.06F;
                    level.cam.Zoom -= 0.01F;
                }
                else
                {

                }
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Space))
            {
                //   level.cam.Zoom = 1F;
                level.LoadPlanetVectors();

            }
            if (Keyboard.GetState().IsKeyDown(Keys.X))
            {

                level.cam.Rotation -= 0.1f;

            }
            if (Keyboard.GetState().IsKeyDown(Keys.C))
            {

                level.cam.Rotation += 0.1f;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                game.Exit();
            }


        }