/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } Transitions.Places(); Transitions.Transition(); Collisions.PlayerCheck(); Collisions.EnemyCheck(); Collisions.Combat(); if (Keyboard.GetState().IsKeyDown(Keys.Up)) { player1.Player_x -= (Math.Sin(player1.Player_rotation) * 1); player1.Player_y -= (Math.Cos(player1.Player_rotation) * 1); } if (Keyboard.GetState().IsKeyDown(Keys.Down)) { player1.Player_x += (Math.Sin(player1.Player_rotation) * 1); player1.Player_y += (Math.Cos(player1.Player_rotation) * 1); } if (Keyboard.GetState().IsKeyDown(Keys.Right)) { player1.Player_rotation -= 0.05f; } if (Keyboard.GetState().IsKeyDown(Keys.Left)) { player1.Player_rotation += 0.05f; } // TODO: Add your update logic here player1.Update(); TheEnemy.Update(); Spear.Update(); base.Update(gameTime); this.Draw(gameTime); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); Transitions.CastleBGM = Content.Load <Song>("bgmusic01 (chill)"); Transitions.PlainsBGM = Content.Load <Song>("bgmusic22 (As long as a word remains unspoken)"); Transitions.ForestBGM = Content.Load <Song>("bgmusic17 (elegy)"); Transitions.CaveBGM = Content.Load <Song>("bgmusic14 Arpology 2 (Ambient Synth version)"); castlePlace = Content.Load <Texture2D>("Castle1_25x25_800x600"); plainsPlace = Content.Load <Texture2D>("Plains1_25x25_800x600"); plainsGrass = Content.Load <Texture2D>("GrassTop"); forestPlace = Content.Load <Texture2D>("Forest1_25x25_800x600"); cavePlace = Content.Load <Texture2D>("Cave1_25x25_800x600"); metalGauge = Content.Load <Texture2D>("MetalGauge"); lifeGreen = Content.Load <Texture2D>("LifeGreen"); lifeYellowGreen = Content.Load <Texture2D>("LifeYellowGreen"); lifeYellow = Content.Load <Texture2D>("LifeYellow"); lifeOrange = Content.Load <Texture2D>("LifeOrange"); lifeRed = Content.Load <Texture2D>("LifeRed"); Spear.Spear1_Texture = Content.Load <Texture2D>("Spear1"); Spear.Spear2_Texture = Content.Load <Texture2D>("Spear2"); Spear.Spear3_Texture = Content.Load <Texture2D>("Spear3"); Spear.Spear4_Texture = Content.Load <Texture2D>("Spear4"); Spear.Spear5_Texture = Content.Load <Texture2D>("Spear5"); Spear.Spear6_Texture = Content.Load <Texture2D>("Spear6"); Spear.Spear7_Texture = Content.Load <Texture2D>("Spear7"); TheEnemy.EnemyBrown = Content.Load <Texture2D>("enemyBrown_triangle"); TheEnemy.EnemyGreenBrown = Content.Load <Texture2D>("enemyGreenBrown_triangle"); TheEnemy.EnemyNormal = Content.Load <Texture2D>("enemyNormal_triangle"); TheEnemy.EnemyGuard = Content.Load <Texture2D>("enemyGuard_triangle"); TheEnemy.EnemyKnight = Content.Load <Texture2D>("enemyKnight_triangle"); TheEnemy.EnemyEliteKnight = Content.Load <Texture2D>("enemyEliteKnight_triangle"); player1.Player_texture = Content.Load <Texture2D>("player1_triangle"); allyKing = Content.Load <Texture2D>("allyKing_triangle"); TheEnemy.Initialize(); // TODO: use this.Content to load your game content here }