Esempio n. 1
0
        protected override void Initialize()
        {

            level = new NewLevel(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, Content) {backgroundVector = new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2)} ;
            player = new Player(this.Content);
            input = new Input();
            base.Initialize();

        }
Esempio n. 2
0
        public  void UpdatePosistion(NewLevel level)
        {
            // Direction = new Vector2((shipSpeed) * Math.Cos(shipAngle), (shipSpeed) * Math.Sin(shipAngle));
            Direction = new Vector2(Convert.ToSingle((Speed) * Math.Sin(Rotation * -1)), Convert.ToSingle((Speed) * Math.Cos(Rotation * -1)));


            level.backgroundVector += Direction * Speed;
            if (Vector2.Distance(new Vector2(0, 0), level.backgroundVector) >= 10513213213215)
            {
                ResetPosistion(false, level);

            }
        }
Esempio n. 3
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();
            }


        }
Esempio n. 4
0
        public void ResetPosistion(bool manual, NewLevel level)
        {
            level.backgroundVector = new Vector2(0, 0);

            this.Speed = 0;
            if (manual == true)
            {
                Rotation = 0;
            }
        }
Esempio n. 5
0
 public NewLevel(float Width, float Height, ContentManager Content)
 {
     cam.Origin = new Vector2(Width / 2, Height / 2);
     cam.Zoom = 0.5f;
     cam.Pos = new Vector2(Width / 2, Height / 2);
     maxOrbitSpeed = 0.001F;
     minOrbitSpeed = 0.00003F ;
     thisLevel = this;
     LoadPlanetVectors();
 }