public override void Draw(GameTime gameTime) { graphicsDevice.Clear(colorSplash); spriteBatch.Begin(SpriteSortMode.Texture); if (splash != null) { splash.draw(spriteBatch); } spriteBatch.End(); }
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 void drawExplosion(float currXMissile, float currYMissile) { explosionAnimation.setPos(currXMissile, currYMissile); explosionAnimation.draw(spriteBatch); }
public override void Draw(GameTime gameTime) { if (score >= 1000) { status = "THE END!"; } else if (player.hitPoints == 0) { status = "YOU DEAD!"; } else { status = "Missile Left: " + missileCount; } spriteBatch.Begin(); backgroundLevel2.Draw(spriteBatch); spriteBatch.DrawString(scoreFont, "Score: " + score + "/1000", new Vector2(20, 20), Color.Black); // Draw Score on top left spriteBatch.DrawString(scoreFont, status, new Vector2(1100, 20), Color.Black); // Draw missile count spriteBatch.Draw(texMouse, new Rectangle((int)mouse_x, (int)mouse_y, 16, 16), Color.White); // draw the mouse here enemy1.Draw(spriteBatch); enemy2.Draw(spriteBatch); player.Draw(spriteBatch); missileSmoke.Draw(spriteBatch); if (timer > 300) { life.setActiveAndVisible(true); life.draw(spriteBatch); } // If certain conditions are met, then draw these weapons if (drawMissile == true && missileCount != 0) { missile.draw(spriteBatch); missile.setPosY(missile.getPosY() - 3); missileSmoke.sysPos = new Vector2(missile.getPosX() + missile.getWidth() / 2, missile.getPosY() + missile.getHeight()); } if (anchorDraw == true) { anchor.setActiveAndVisible(true); anchor.draw(spriteBatch); anchor.setPosY(anchor.getPosY() + 4); } if (drawMines && mineCount == 1) { mine.setPos(minePos.X, minePos.Y); mine.draw(spriteBatch); } // If there is a collision, draw explosion animation if (collision1 == true) { drawMissile = false; drawExplosion(currXMissile, currYMissile); enemy1.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700)); if (explostionTimer == 100) { collision1 = false; score += 50; explostionTimer = 0; } } if (collision2 == true) { drawMissile = false; drawExplosion(currXMissile, currYMissile); enemy2.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700)); if (explostionTimer == 80) { score += 100; collision2 = false; explostionTimer = 0; missileSmoke.deActivate(); } } if (mineCollisionToggle == true) { mineCollission = false; mineExplostionAnimation.setPos(mineCurrPos.X - mine.getWidth() / 2, mineCurrPos.Y - mine.getHeight() / 2); mineExplostionAnimation.draw(spriteBatch); if (explostionTimer == 100) { mineExplostionAnimation.makeInactive = true; enemy1.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700)); mineCollisionToggle = false; explostionTimer = 0; } } if (mineCollisionToggle2 == true) { mineCollission2 = false; mineExplostionAnimation.setPos(mineCurrPos.X - mine.getWidth() / 2, mineCurrPos.Y - mine.getHeight() / 2); mineExplostionAnimation.draw(spriteBatch); if (explostionTimer == 100) { mineExplostionAnimation.makeInactive = true; enemy2.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700)); mineCollisionToggle2 = false; explostionTimer = 0; } } // Draw BB if (showBB) { player.drawInfo(spriteBatch, Color.White, Color.Yellow); enemy1.drawInfo(spriteBatch, Color.White, Color.Yellow); enemy2.drawInfo(spriteBatch, Color.White, Color.Yellow);; missile.drawInfo(spriteBatch, Color.White, Color.Yellow); life.drawInfo(spriteBatch, Color.White, Color.Yellow); mine.drawInfo(spriteBatch, Color.White, Color.Yellow); anchor.drawInfo(spriteBatch, Color.White, Color.Yellow); //weaponList.drawInfo(spriteBatch, Color.White, Color.Yellow); } spriteBatch.End(); }
public override void Draw(GameTime gameTime) { if (score >= 300) { status = "NEXT LEVEL!"; } else { status = "Missile Left: " + missileCount; } graphicsDevice.Clear(Color.Aqua); spriteBatch.Begin(); Dir.background.Draw(spriteBatch); player.draw(spriteBatch); enemyList.Draw(spriteBatch); missileSmoke.Draw(spriteBatch); spriteBatch.DrawString(scoreFont, "Score: " + score + "/300", new Vector2(20, 20), Color.Black); // Draw Score on top left spriteBatch.DrawString(scoreFont, status, new Vector2(1100, 20), Color.Black); // Draw missile count if (drawMissile == true && missileCount != 0) { missile.draw(spriteBatch); missile.setPosY(missile.getPosY() - 3); missileSmoke.sysPos = new Vector2(missile.getPosX() + missile.getWidth() / 2, missile.getPosY() + missile.getHeight()); } if (collision1 == true) { drawMissile = false; drawExplosion(currXMissile, currYMissile); enemy1.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700)); if (explostionTimer == 110) { collision1 = false; score += 50; explostionTimer = 0; missileSmoke.deActivate(); } } if (collision2 == true) { drawMissile = false; drawExplosion(currXMissile, currYMissile); enemy2.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700)); if (explostionTimer == 80) { score += 100; collision2 = false; explostionTimer = 0; missileSmoke.deActivate(); } } if (collision3 == true) { drawMissile = false; drawExplosion(currXMissile, currYMissile); enemy3.setPos(Dir.rnd.Next(-400, -250), Dir.rnd.Next(200, 700)); if (explostionTimer == 80) { score += 50; collision3 = false; explostionTimer = 0; missileSmoke.deActivate(); } } if (showBoundary) { //LineBatch.drawLineRectangle(spriteBatch, new Rectangle(1, 0, rightBoundary+4, bottomBoundary), Color.Blue); player.drawInfo(spriteBatch, Color.Yellow, Color.Red); missile.drawInfo(spriteBatch, Color.Black, Color.Red); enemyList.drawInfo(spriteBatch, Color.Yellow, Color.Purple); } spriteBatch.End(); }