Esempio n. 1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            // Draw our button
            button.customDrawButton(spriteBatch);

            if (PlayerInput.keyHeld(Keys.B))
            {
                button.drawInfo(spriteBatch, Color.Red, Color.Green);
            }
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        public override void Draw(SpriteBatch sb)
        {
            //int mgStates = 0; // game state
            // 0=waiting startup
            // 1=playing
            // 2=waiting for respawn
            // 3=Ending count You Win
            // 4=Ending count You Looser
            // 5=Game over You Winner
            // 6=Game over You Looser

            sb.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
            drawBack(sb);
            if (mgState == 0 || mgState == 1 || mgState == 3)
            {
                shooter.Draw(sb);
            }
            drawBullets(sb);
            targets.Draw(sb);
            if (showbb)
            {
                targets.drawInfo(sb, Color.Beige, Color.Gray);
                shooter.drawInfo(sb, Color.Beige, Color.Gray);
            }
            explosions.Draw(sb);
            eyeCandy.Draw(sb);
            drawMask(sb);

            // draw lives
            for (int i = 0; i < lives; i++)
            {
                //lives
                Rectangle r = new Rectangle((int)(outerRectangle.X + 2 + i * (actualShooterSize.X + 4)), (int)(innerRectangle.Y + innerRectangle.Height + 2), (int)actualShooterSize.X - 2, (int)actualShooterSize.Y - 2);
                sb.Draw(shooterTex, r, Color.White);
            }

            // draw score
            sb.DrawString(font, mgScore.ToString(), new Vector2(outerRectangle.X + 2, outerRectangle.Y + 1), Color.Black);

            drawTexts(sb);

            sb.End();
        }
Esempio n. 4
0
        /// <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);

            spriteBatch.Begin();
            back1.Draw(spriteBatch);  //***
            paddle.Draw(spriteBatch); //***
            ball.Draw(spriteBatch);
            sl.Draw(spriteBatch);

            if (showbb)
            {
                paddle.drawBB(spriteBatch, Color.Black);
                paddle.drawHS(spriteBatch, Color.Green);
                ball.drawInfo(spriteBatch, Color.Gray, Color.Green);
                sl.drawInfo(spriteBatch, Color.Brown, Color.Aqua);
                LineBatch.drawLineRectangle(spriteBatch, playArea, Color.Blue);
            }
            spriteBatch.End();

            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
        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();
        }