// <summary> /// Draws the gameplay screen. /// </summary> public override void Draw(GameTime gameTime) { bloom.BeginDraw(); ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.Black, 0, 0); SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null, null, null, cam2D.View); foreach (SeekerDrone drone in Drones) { drone.draw(spriteBatch); } foreach (Square square in Squares) { square.Draw(spriteBatch); if (square.isTouching) { ScreenManager.GraphicsDevice.Clear(Color.White); } } foreach (Wall wall in Walls) { wall.Draw(spriteBatch); } spriteBatch.Draw(spinningWheel.getTex, spinningWheel.shapeBody.Position * 64, null, Color.White, spinningWheel.shapeBody.Rotation, new Vector2(100, 100), 1f, SpriteEffects.None, 0.8f); if (!GamePad.GetState(PlayerIndex.One).IsConnected) { mouse = Mouse.GetState(); Vector2 mousePos = new Vector2(mouse.X, mouse.Y); spriteBatch.Draw(reticle, mousePos + cam2D.Position - new Vector2(1024 / 2, 768 / 2), null, Color.White, 0f, new Vector2(10, 10), 1f, SpriteEffects.None, 1f); } playerBody.draw(spriteBatch); spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0 || pauseAlpha > 0) { float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2); ScreenManager.FadeBackBufferToBlack(alpha); } }
/// <summary> /// Draws the background screen. /// </summary> public override void Draw(GameTime gameTime) { SpriteBatch spriteBatch = ScreenManager.SpriteBatch; Viewport viewport = ScreenManager.GraphicsDevice.Viewport; Rectangle fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height); bloom.Visible = true; bloom.BeginDraw(); spriteBatch.Begin(); ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.Black, 0, 0); spriteBatch.Draw(backgroundTexture, new Vector2(512 - (backgroundTexture.Width / 2), 10), new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha)); spriteBatch.End(); }
/// Draws the gameplay screen. /// </summary> public override void Draw(GameTime gameTime) { bloom.BeginDraw(); ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.Black, 0, 0); SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null, null, null, cam2D.View); spriteBatch.Draw(playerSpwan, new Vector2(0, 0), Color.White); foreach (Wall wall in walls) { wall.Draw(spriteBatch); } assetPos = new Vector2(mouse.X, mouse.Y) + cam2D.Position - new Vector2(1024 / 2, 768 / 2); spriteBatch.Draw(blueWall, assetPos, null, Color.White, assetRotation, new Vector2(blueWall.Width / 2, blueWall.Height / 2), 1f, SpriteEffects.None, 1f); spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0 || pauseAlpha > 0) { float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2); ScreenManager.FadeBackBufferToBlack(alpha); } }
public override void Draw(GameTime gameTime) { bloom.BeginDraw(); batch = ScreenManager.SpriteBatch; ScreenManager.GraphicsDevice.Clear(Color.Black); batch.Begin(); batch.Draw(tex, new Vector2(512, 384), null, Color.White, 0f, new Vector2(tex.Width / 2, tex.Height / 2), 1f, SpriteEffects.None, 1f); UI.Draw(batch); batch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0 || pauseAlpha > 0) { float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2); ScreenManager.FadeBackBufferToBlack(alpha); } base.Draw(gameTime); }
/// <summary> /// Draws the gameplay screen. /// </summary> public override void Draw(GameTime gameTime) { bloom.BeginDraw(); ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.Black, 0, 0); // Our player and enemy are both actually just text strings. SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null, null, null, cam2D.View); foreach (Square sqaure in Squares) { sqaure.Draw(spriteBatch); if (sqaure.isTouching) { ScreenManager.GraphicsDevice.Clear(Color.White); } } foreach (Wall wall in Walls) { wall.Draw(spriteBatch); } foreach (Collectable collectable in Collectables) { collectable.draw(spriteBatch); } foreach (Shape shape in Shapes) { shape.Draw(spriteBatch); if (shape.isTouching) { ScreenManager.GraphicsDevice.Clear(Color.White); } } foreach (Bady bady in Badies) { foreach (Laser laser in bady.Lasers) { if (laser.hasHit) { ScreenManager.GraphicsDevice.Clear(Color.White); } } bady.Draw(spriteBatch); } spriteBatch.Draw(circleTex, circleBody.Position * 64, null, Color.White, circleBody.Rotation, new Vector2(20f, 20f), 1f, SpriteEffects.None, 1f); foreach (Whip whip in Whips) { whip.Draw(spriteBatch); } playerBody.draw(spriteBatch); spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0 || pauseAlpha > 0) { float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2); ScreenManager.FadeBackBufferToBlack(alpha); } }
/// <summary> /// Draws the gameplay screen. /// </summary> public override void Draw(GameTime gameTime) { bloom.BeginDraw(); ScreenManager.GraphicsDevice.Clear(ClearOptions.Target, Color.Black, 0, 0); // Our player and enemy are both actually just text strings. SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null, null, null, cam2D.View); foreach (Square sqaure in Squares) { sqaure.Draw(spriteBatch); } foreach (Wall wall in Walls) { wall.Draw(spriteBatch); } foreach (Collectable collectable in Collectables) { collectable.draw(spriteBatch); } foreach (Shape shape in Shapes) { shape.Draw(spriteBatch); if (shape.isTouching) { } } foreach (Bady bady in Badies) { foreach (Laser laser in bady.Lasers) { if (laser.hasHit) { } } bady.Draw(spriteBatch); } spriteBatch.Draw(circleTex, circleBody.Position * 64, null, Color.White, circleBody.Rotation, new Vector2(20f, 20f), 1f, SpriteEffects.None, 1f); foreach (Whip whip in Whips) { whip.Draw(spriteBatch); } if (!(GamePad.GetState(PlayerIndex.One).IsConnected)) { // for some reason I've had to add a get mouse state here? It works in other levels without. Could casue perfomance issues if not checked. mouse = Mouse.GetState(); Vector2 mousePos = new Vector2(mouse.X, mouse.Y); spriteBatch.Draw(reticle, mousePos + cam2D.Position - new Vector2(1024 / 2, 768 / 2), null, Color.White, 0f, new Vector2(10, 10), 1f, SpriteEffects.None, 1f); } playerBody.draw(spriteBatch); spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0 || pauseAlpha > 0) { float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2); ScreenManager.FadeBackBufferToBlack(alpha); } }