public override void Draw(GameTime gameTime) { graphicsDevice.Clear(Color.Aqua); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); scrolling1.Draw(spriteBatch); scrolling2.Draw(spriteBatch); back1.Draw(spriteBatch); spriteBatch.End(); }
public void Draw(SpriteBatch spriteBatch) { scroll1.Draw(spriteBatch); scroll2.Draw(spriteBatch); spriteBatch.Draw(Circle, CirlceRect, new Color(0, 0, 0, 100)); foreach (MenuObject obj in objects) { obj.Draw(spriteBatch); } }
public override void Draw(GameTime gameTime) { graphicsDevice.Clear(Color.BlanchedAlmond); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); scrolling1.Draw(spriteBatch); scrolling2.Draw(spriteBatch); back1.Draw(spriteBatch); //*** paddle.Draw(spriteBatch); //*** ball.draw(spriteBatch); if (p != null) { p.Draw(spriteBatch); } if (showbb) { paddle.drawBB(spriteBatch, Color.Black); paddle.drawHS(spriteBatch, Color.Green); dragonList.drawInfo(spriteBatch, Color.Red, Color.Blue); LineBatch.drawLineRectangle(spriteBatch, playArea, Color.Blue); ball.drawInfo(spriteBatch, Color.Gray, Color.Green); } if (ball.getPosY() > bot) { //ball.setPosY(60); spriteBatch.DrawString(font1, "Game Over!", new Vector2(100, 100), Color.Green); //dragonList.drawActive(spriteBatch); } //foreach (Sprite3 p in Spritewall) // p.Draw(spriteBatch); if (wl != null) { wl.Draw(spriteBatch, Color.Teal, Color.Red); } LineBatch.drawLineRectangle(spriteBatch, rectangle, Color.Gray); //draw animation //string output1 = "Socre: "; Vector2 FontOrigin1 = font1.MeasureString("a") / 2; spriteBatch.DrawString(font1, "Score " + scoure.ToString(), new Vector2(100, 100), Color.Green); //anmiation1.Draw(spriteBatch); // dragon.Draw(spriteBatch); //if(dragonList != null) dragonList.drawActive(spriteBatch); spriteBatch.End(); }
public override void Draw(GameTime gameTime) { graphicsDevice.Clear(Color.Aqua); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); scrolling1.Draw(spriteBatch); scrolling2.Draw(spriteBatch); back1.Draw(spriteBatch); //anmiation1.Draw(spriteBatch); anmiationList.drawActive(spriteBatch); //if (keyState.IsKeyDown(Keys.H) && !prevKeyState.IsKeyDown(Keys.H)) //{ // back2.Draw(spriteBatch); //} spriteBatch.End(); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here sSpriteBatch.Begin(); scrolling1.Draw(sSpriteBatch); scrolling2.Draw(sSpriteBatch); scrolling3.Draw(sSpriteBatch); sanic.Draw(); gameState.Draw(gameTime); sSpriteBatch.End(); base.Draw(gameTime); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { switch (level) { case 0: spriteBatch.Begin(); scrolling1.Draw(spriteBatch); scrolling2.Draw(spriteBatch); break; case 1: spriteBatch.Begin(); scroll1.Draw(spriteBatch); scroll2.Draw(spriteBatch); break; case 2: spriteBatch.Begin(); level3a.Draw(spriteBatch); level3b.Draw(spriteBatch); break; case 3: spriteBatch.Begin(); level4a.Draw(spriteBatch); level4b.Draw(spriteBatch); break; } //spriteBatch.Draw (fondo, posfondo, Color.White); foreach (bullets bullet in bullets) { bullet.Draw(spriteBatch); } foreach (Vector2 posicionEnemigo in posicionesEnemigo) { spriteBatch.Draw(enemigo, posicionEnemigo, Color.White); } spriteBatch.DrawString(fuente1, "destruyelos:" + puntos, posicioncor, Color.DarkRed); spriteBatch.DrawString(fuente1, "vidas:" + vidas, posvidas, Color.GhostWhite); spriteBatch.DrawString(fuente2, "nivel:" + level, poslev, Color.Goldenrod); player.Draw(spriteBatch); if (puntos >= 6000) { spriteBatch.Begin(); spriteBatch.Draw(fondo, posfondo, Color.AliceBlue); KeyboardState keyboard = Keyboard.GetState(); EndRun(); EndDraw(); posicionesEnemigo.Clear(); spriteBatch.DrawString(fuente1, "puntos:" + puntos, poscicionfp, Color.Black); spriteBatch.DrawString(fuente1, "vidas:" + vidas, poscicionfv, Color.DarkMagenta); spriteBatch.DrawString(fuente2, "oprima enter para salir", possprite, Color.DarkOrchid); if (keyboard.IsKeyDown(Keys.Enter)) { this.Exit(); } } spriteBatch.End(); base.Draw(gameTime); if (vidas == 0) { Thread.Sleep(3000); this.Exit(); } if (puntos == 4000) { vidas = vidas + 1; } }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); //BACK GROUND spriteBatch.Begin(); scrolling1.Draw(spriteBatch); scrolling2.Draw(spriteBatch); spriteBatch.End(); //CREATE VIEW POINT FROM CAMERA var vp = GraphicsDevice.Viewport; _spriteBatchEffect.View = Matrix.CreateLookAt(_cameraPosition, _cameraPosition + Vector3.Forward, Vector3.Up); _spriteBatchEffect.Projection = Matrix.CreateOrthographic(cameraViewWidth, cameraViewWidth / vp.AspectRatio, 0f, -1f); //BEGIN DRAWING SPRITES FROM CAMERA VIEW spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, RasterizerState.CullClockwise, _spriteBatchEffect); //DRAW PLAYER spriteBatch.Draw(playerTexture, _player.getBody().Position, null, Color.White, _player.getBody().Rotation, _player.getTextureOrigin(), _player.getBodySize() / _player.getTextureSize(), SpriteEffects.FlipVertically, 0f); //DRAW ROAD RoadManager.Draw(spriteBatch, _road1, _road2, _road3); //DRAW OBSTACLES ObstacleManagerJ.Draw(spriteBatch, _jumpObstacles1, _jumpObstacles2, _jumpObstacles3); ObstacleManagerC.Draw(spriteBatch, _crouchObstacles1, _crouchObstacles2, _crouchObstacles3); //END spriteBatch.End(); //UI spriteBatch.Begin(); spriteBatch.DrawString(font, "Score: " + (int)_player.getScore(), new Vector2(50, 80), Color.White); if (!_player.getIsMoving() && !_player.getIsCrashed()) { spriteBatch.DrawString(font, " CONTROLS\n1. Press blue puck to jump.\n2. Press yellow puck to crouch.\n3.Press both pucks at the same time to start", new Vector2(500, 750 / 2), Color.Yellow); } if (_player.getIsOutOfBounds()) { spriteBatch.DrawString(font, " OUT OF BOUNDS!\n\n\n\n\n\n\nPress both pucks at the same time to restart", new Vector2(500, 750 / 2), Color.Red); } else if (_player.getIsCrashed()) { spriteBatch.DrawString(font, " CRASHED!\n\n\n\n\n\n\nPress both pucks at the same time to restart", new Vector2(500, 750 / 2), Color.Red); } if (_player.getIsPassed()) { spriteBatch.DrawString(font, "Enemy Passed! +500", new Vector2(50, 20), Color.Yellow); } if (_player.getLevelUp() && _player.getLevelUptimer() < (float)gameTime.TotalGameTime.TotalSeconds) { spriteBatch.DrawString(font, " LEVEL UP!\nSpeed Increased", new Vector2(800, 40), Color.Yellow); } spriteBatch.End(); //DEBUGGER if (debuggerSwitch) { debugView.RenderDebugData(_spriteBatchEffect.Projection, _spriteBatchEffect.View, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone, 0.8f); spriteBatch.Begin(); spriteBatch.DrawString(font, "Time: " + (int)totalTime + " seconds", new Vector2(50, 60), Color.White); spriteBatch.DrawString(font, "Obstacles Passed: " + _player.getObstaclesPassed(), new Vector2(50, 80), Color.White); if (_player.getCurrentRoad() == 1) { spriteBatch.DrawString(font, "Current Road: MIDDLE (road" + _player.getCurrentRoad() + ")", new Vector2(50, 220), Color.White); } else if (_player.getCurrentRoad() == 2) { spriteBatch.DrawString(font, "Current Road: TOP (road" + _player.getCurrentRoad() + ")", new Vector2(50, 220), Color.White); } else if (_player.getCurrentRoad() == 3) { spriteBatch.DrawString(font, "Current Road: BOTTOM (road" + _player.getCurrentRoad() + ")", new Vector2(50, 220), Color.White); } else if (_player.getCurrentRoad() == 4) { spriteBatch.DrawString(font, "Current Road: OUT OF BOUNDS", new Vector2(50, 220), Color.White); } if (_player.getIsOnRoad()) { spriteBatch.DrawString(font, "ON ROAD", new Vector2(50, 240), Color.White); } else { spriteBatch.DrawString(font, "OFF ROAD", new Vector2(50, 240), Color.White); } spriteBatch.DrawString(font, "Player Pos: " + _player.getBody().Position, new Vector2(50, 260), Color.White); spriteBatch.End(); } base.Draw(gameTime); }