/// <summary> /// Example Input Method, rotates using cursor keys and zooms using mouse wheel /// </summary> protected virtual void Input(Player pl) { keyState = Keyboard.GetState(); //Check Move if (keyState.IsKeyDown(Keys.Up)) { pos.Y+= 5; } if (keyState.IsKeyDown(Keys.Down)) { pos.Y -= 5; } if (keyState.IsKeyDown(Keys.Left)) { pos.X += 5; } if (keyState.IsKeyDown(Keys.Right)) { pos.X -= 5; } }
/// <summary> /// Update the camera view /// </summary> public void Update(Player pl) { //Call Camera Input Input(pl); //_pos = tank.Position; //Clamp zoom value zoom = MathHelper.Clamp(zoom, 0.0f, 10.0f); //Create view matrix transform = Matrix.CreateRotationZ(rotation) * Matrix.CreateScale(new Vector3(zoom, zoom, 1)) * Matrix.CreateTranslation(pos.X,pos.Y, 0); //Update inverse matrix inverseTransform = Matrix.Invert(transform); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here player=new Player(); plLives = new PlayerLives(); minimap = new Sprite(); bgTL = new Sprite(); bgTR = new Sprite(); bgBL = new Sprite(); bgBR = new Sprite(); pipeT1 = new PipeT1[5]; pipeT2 = new PipeT2[5]; pipeT3 = new PipeT3[5]; pipeT4 = new PipeT4[5]; cogs = new Cog[12]; viz = new VisualizationData(); MediaPlayer.IsVisualizationEnabled = true; MediaPlayer.IsRepeating = true; int i = 0; for (i = 0; i < pipeT1.Length; i++) { pipeT1[i] = new PipeT1(); } for (i = 0; i < pipeT2.Length; i++) { pipeT2[i] = new PipeT2(); } for (i = 0; i < pipeT3.Length; i++) { pipeT3[i] = new PipeT3(); } for (i = 0; i < pipeT4.Length; i++) { pipeT4[i] = new PipeT4(); } for (i = 0; i < cogs.Length; i++) { cogs[i] = new Cog(); } base.Initialize(); }