Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Added Fields:
- private Texture2D background;
- Changes to LoadContent:
- protected override void LoadContent()
- {
- // Create a new SpriteBatch, which can be used to draw textures.
- spriteBatch = new SpriteBatch(GraphicsDevice);
- texture = this.Content.Load<Texture2D>("Bee");
- text1 = Content.Load<SpriteFont>("text");
- background = Content.Load<Texture2D>("Background");
- // Sound
- backgroundSound = Content.Load<Song>("Happy_Dreams.Background");
- MediaPlayer.Play(backgroundSound);
- MediaPlayer.Volume -= 0.5f;
- MediaPlayer.IsRepeating = true;
- // TODO: use this.Content to load your game content here
- gameObjects.Add(new Drone(new Vector2(0, 0)));
- //gameObjects.Add(new Mine(new Vector2(200, 100));
- foreach (GameObject gameObject in gameObjects)
- {
- gameObject.LoadContent(Content);
- }
- }
- Changes to Draw:
- protected override void Draw(GameTime gameTime)
- {
- GraphicsDevice.Clear(Color.CornflowerBlue);
- // TODO: Add your drawing code here
- spriteBatch.Begin();
- spriteBatch.Draw(background, position, origin: new Vector2(0, 0));
- spriteBatch.End();
- spriteBatch.Begin();
- spriteBatch.Draw(texture, position, origin: new Vector2(64, 64));
- foreach (GameObject gameObject in gameObjects)
- {
- gameObject.Draw(spriteBatch);
- }
- spriteBatch.DrawString(text1, nek.nektarInfo,
- new Vector2(50, graphics.GraphicsDevice.Viewport.Height / 2),
- Color.White,
- 0,
- Vector2.Zero,
- 1,
- SpriteEffects.None,
- 1f);
- spriteBatch.DrawString(text1, nek.waitingBees,
- new Vector2(100, graphics.GraphicsDevice.Viewport.Height / 2 + 80),
- Color.White,
- 0,
- Vector2.Zero,
- 1,
- SpriteEffects.None,
- 1f);
- spriteBatch.DrawString(text1, nek.enteringBees,
- new Vector2(100, graphics.GraphicsDevice.Viewport.Height / 2 + 110),
- Color.White,
- 0,
- Vector2.Zero,
- 1,
- SpriteEffects.None,
- 1f);
- spriteBatch.DrawString(text1, nek.leavingBees,
- new Vector2(100, graphics.GraphicsDevice.Viewport.Height / 2 + 140),
- Color.White,
- 0,
- Vector2.Zero,
- 1,
- SpriteEffects.None,
- 1f);
- // Mined nektar
- spriteBatch.DrawString(text1, nek.minedNektar,
- new Vector2(100, graphics.GraphicsDevice.Viewport.Height / 2 + 170),
- Color.White,
- 0,
- Vector2.Zero,
- 1,
- SpriteEffects.None,
- 1f);
- // Remaining nektar
- spriteBatch.DrawString(text1, nek.remainingNektar,
- new Vector2(100, graphics.GraphicsDevice.Viewport.Height / 2 + 200),
- Color.White,
- 0,
- Vector2.Zero,
- 1,
- SpriteEffects.None,
- 1f);
- spriteBatch.End();
- base.Draw(gameTime);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement