コード例 #1
0
        public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            /******************************CODE POUR LE BACKGROUND*********************
             ***************************************************************************/
            background1.Draw(spriteBatch);
            background2.Draw(spriteBatch);

            /******************************CODE POUR LE HEROS***************************
            ***************************************************************************/
            Heros.Draw(spriteBatch, gameTime);

            for (int i = 0; i < Heros.NbreDeVies; i++)
            {
                spriteBatch.Draw(Content_Manager.getInstance().Textures["vie"], new Vector2(375 - (i + 1) * 30, 10), Color.White);
            }

            /******************************CODE POUR LES ENNEMIS************************
            ***************************************************************************/

            foreach (Personnages perso in ennemis)
            {
                perso.Draw(spriteBatch, gameTime);
            }
            spriteBatch.DrawString(Content_Manager.getInstance().Polices["PoliceScore"], Convert.ToString(score), new Vector2(400, 0), Color.Orange);
        }
コード例 #2
0
ファイル: MainScreen.cs プロジェクト: Awesomeosity/Team-Rock
        public override void Draw(SpriteBatch spriteBatch)
        {
            _backgroundAudience.Draw(spriteBatch);
            _scrollingBackground.Draw(spriteBatch);

            _fillBarVertical.Draw(spriteBatch);
            _fillBarFlasher.Draw(spriteBatch);
            _fillBarPointer.Draw(spriteBatch);

            _stage.Draw(spriteBatch);
            _winWrestler.Draw(spriteBatch);

            if (_unhinderedTimeToImpact > 0)
            {
                _starSpriteSheetAnimationManager.Draw(spriteBatch);
            }

            switch (_gameState)
            {
            case GameState.IsRunning:
            case GameState.EndStarted:
                _player.Draw(spriteBatch);
                break;

            case GameState.EndAnimations:
                if (_endExplosion.IsAnimationActive)
                {
                    _endExplosion.Draw(spriteBatch);
                }

                if (_hinderedPlayerTimer <= 0)
                {
                    _confetti1.Draw(spriteBatch);
                    _confetti2.Draw(spriteBatch);
                }

                break;

            case GameState.GameOver:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            foreach (Audience audience in _audiences)
            {
                audience.DrawProjectiles(spriteBatch);
            }
        }
コード例 #3
0
        public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            background1.Draw(spriteBatch);
            background2.Draw(spriteBatch);
            int i = 0;

            foreach (string element in ElementsMenus)
            {
                spriteBatch.DrawString(policeMenu, element, new Vector2(fenêtre.Width / 2 - (policeMenu.MeasureString(element).X / 2) + 3,
                                                                        (fenêtre.Height / 2) - (policeMenu.LineSpacing * ElementsMenus.Count / 2) + ((policeMenu.LineSpacing) * i) - 1), Color.White);
                spriteBatch.DrawString(policeMenu, element, new Vector2(fenêtre.Width / 2 - (policeMenu.MeasureString(element).X / 2),
                                                                        (fenêtre.Height / 2) - (policeMenu.LineSpacing * ElementsMenus.Count / 2) + ((policeMenu.LineSpacing) * i)), Color.Red);
                i++;
            }

            spriteBatch.DrawString(Content_Manager.getInstance().Polices["PoliceTitre"], "SPACE WAR", new Vector2(fenêtre.Width / 2 - (Content_Manager.getInstance().Polices["PoliceTitre"].MeasureString("SPACE WAR").X / 2), 50), Color.Orange);
        }
コード例 #4
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            _backgroundSprite.Draw(spriteBatch);
            _audienceScrolling.Draw(spriteBatch);

            _cinematicBackgroundScroller.Draw(spriteBatch);

            _stage.Draw(spriteBatch);
            _winWrestler.Draw(spriteBatch);
            _starSpriteSheetAnimationManager.Draw(spriteBatch);

            _playerSprite.Draw(spriteBatch);

            foreach (Audience audience in _audiences)
            {
                audience.DrawProjectiles(spriteBatch);
            }
        }
コード例 #5
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            SpriteBatch.Begin();
            _scrollingBackground.Draw();

            if (_gameOver)
            {
                SpriteBatch.DrawString(_font, "!!### Game Over ###!!", new Vector2(ScreenWidth / 3, ScreenHeight / 3), Color.Red, 0f, new Vector2(0, 0), new Vector2(2, 2), SpriteEffects.None, 0f);
            }
            else if (_spaceInvadersBoard.SpaceInvaderList.Count <= 0)
            {
                SpriteBatch.DrawString(_font, "!!### You Win ###!!", new Vector2(ScreenWidth / 3, ScreenHeight / 3), Color.Green, 0f, new Vector2(0, 0), new Vector2(2, 2), SpriteEffects.None, 0f);
            }

            base.Draw(gameTime);
            SpriteBatch.End();
        }
コード例 #6
0
ファイル: Game1.cs プロジェクト: ZhouyangYe/CS2053lab3
        /// <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

            spriteBatch.Begin();
            //spriteBatch.Draw(backgroundTexture, backgroundRectangle, Color.White);
            myBackground.Draw(spriteBatch);
            if (!gameInfoBetween.getFinish())
            {
                gameInfoBetween.draw(spriteBatch);
            }
            else if (gameInfoObject.getWIN() || gameInfoObject.getLOSE())
            {
                if (gameInfoObject.getWIN())
                {
                    gameInfoObject2.setGameInfo("Perfect fight!" + "\nSeems we can" + "\n win the war, right?");
                    gameInfoObject2.draw(spriteBatch);
                }
                else
                {
                    gameInfoObject2.setGameInfo("Mission Failed");
                    gameInfoObject2.draw(spriteBatch);
                }
            }
            else
            {
                if (bonus.getShow())
                {
                    bonus.draw(spriteBatch);
                    framecount++;
                }
                if (bonus.getShow() && framecount == 30)
                {
                    framecount = 0;
                    bonus.setShow(false);
                }
                foreach (DestroyerObject1 b in destroyerobjcet1list)
                {
                    b.draw(spriteBatch);
                }
                foreach (BomberObject b in bomberObjectList)
                {
                    b.draw(spriteBatch);
                }
                foreach (BombObject b in bombObjectList)
                {
                    b.draw(spriteBatch);
                }
                foreach (AircraftCarrier ac in aircraftcarriers)
                {
                    ac.draw(spriteBatch);
                }
                foreach (ProtectFighter fl in protectObjectList)
                {
                    fl.draw(spriteBatch);
                }
                foreach (BattleShip bs in battleship)
                {
                    bs.draw(spriteBatch);
                }
                playerObject.draw(spriteBatch);
                foreach (GameObject g in gameObjectList)
                {
                    g.draw(spriteBatch);
                }
                gameInfoObject.draw(spriteBatch);
            }
            spriteBatch.End();
            base.Draw(gameTime);
        }
コード例 #7
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(SpriteBatch spriteBatch)
        {
            if ((isDisposed == false) || (gokuPlayer.State == MediaState.Playing))
            {
                gokuVidTexture = gokuPlayer.GetTexture();


                spriteBatch.Draw(gokuVidTexture, gokuVidRect, Color.White);
            }

            scrollingbackgroundtop.Draw(spriteBatch);
            scrollingbackgroundbottom.Draw(spriteBatch);
            // spriteBatch.Draw(gWinBackground, gWinRect, Color.White);
            forward.Draw(spriteBatch);
            //    spriteBatch.Draw(wronghands, new Rectangle(0, 0, 800, 600), Color.White);



            /*  if (gokuPlayer.State == MediaState.Stopped || gokuPlayer.State == MediaState.Paused)
             * {
             *    spriteBatch.DrawString(LargeFont, "PRESS ENTER AFTER VIDEO", new Vector2(0, 400), Color.White);
             * }*/


            /*    if (displayenter == true)
             *  {
             *
             *  }
             *  else
             *  {
             *  }*/



            ballobjectengine.Draw(spriteBatch);
            validationobjectengine.Draw(spriteBatch);
            // spriteBatch.Draw(masterbackground, masterbackgroundrect, Color.White);

            // homebase.Draw(spriteBatch);

            timer.Draw(spriteBatch);


            spriteBatch.Draw(scoretext, new Rectangle(0, 0, 300, 75), Color.White);
            //spriteBatch.DrawString(spriteFont, score.ToString(), new Vector2(320, 75);


            foreach (Vector2 fingerLoc in Game1.leap.FingerPoints)
            {
                spriteBatch.Draw(fingertextures[0], fingerLoc, Color.White);
                leapcollisionmax.X = (int)fingerLoc.X;
                leapcollisionmax.Y = (int)fingerLoc.Y;
                //    spriteBatch.Draw(fingertextures[0], leap.FirstHandLoc, Color.White);
            }

            spriteBatch.DrawString(LargeFont, score.ToString(), new Vector2(310, 0), Color.White);

            /*
             * spriteBatch.Draw(fingertextures[0], leap.Fingerarray[0], Color.White);
             *
             * spriteBatch.Draw(fingertextures[1], leap.Fingerarray[1], Color.White);
             *
             *
             * spriteBatch.Draw(fingertextures[2], leap.Fingerarray[2], Color.White);
             *
             * spriteBatch.Draw(fingertextures[3], leap.Fingerarray[3], Color.White);
             *
             * spriteBatch.Draw(fingertextures[4], leap.Fingerarray[4], Color.White);*/
            /*     if (ishit == true)
             *   {
             *       spriteBatch.Draw(explosionart, explosionartrect, Color.Red);
             *       spriteBatch.Draw(bottombase, bottombaserect, Color.Red);
             *   }
             *   else if (ishit == false)
             *   {
             *       spriteBatch.Draw(bottombase, bottombaserect, Color.White);
             *   }*/

            // TODO: Add your drawing code here
        }
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(deepestmasterofcode, new Rectangle(0, 0, 800, 600), Color.White);


            forward.Draw(spriteBatch);
            backwards.Draw(spriteBatch);
            // backwardscode.Draw(spriteBatch);
            spriteBatch.Draw(background, backgroundRect, Color.White);


            //   scrollingbackgroundtop.Draw(spriteBatch);
            //   scrollingbackgroundbottom.Draw(spriteBatch);
            // spriteBatch.Draw(computervirus, new Rectangle(0, 200, 256, 256), Color.White);
            // spriteBatch.Draw(wronghands, new Rectangle(0, 0, 800, 600), Color.White);
            // spriteBatch.Draw(infectedcomputer, new Rectangle(300, 100, 256, 128), Color.White);
            //    spriteBatch.Draw(kungfusantaclaus, new Rectangle(0, 0, 800, 100), Color.White);

            //   virusvidtexture = virusplayer.GetTexture();

            //    spriteBatch.Draw(virusvidtexture, virusvidtexturerect, Color.White);

            /* if (secondscreen == true)
             * {
             *   spriteBatch.DrawString(font, "YOUR SCORE PROVES THAT YOU ARE GREAT!", new Vector2(100, 280), Color.Red);
             *
             *   spriteBatch.DrawString(font, PlayVideoGameState.Score.ToString(), new Vector2(400, 300), Color.Red);
             * }*/
            /*     foreach (Vector2 fingerLocC in Game1.leapa.FingerPoints)
             *   {
             *
             *       leapcollisionb.X = (int)fingerLocC.X;
             *       leapcollisionb.Y = (int)fingerLocC.Y;
             *   } */



            /*
             #region JESUS IS LORD <<< GRAPHICS >>> DRAW EVERYTHING TO THE SCREEN JESUS IS LORD GAME 18
             *          //JESUS IS LORD! DRAWS THE BACKGROUN <<< GRAPHICS>>> JESUS IS LORD!
             *          //  spriteBatch.Begin();
             *
             *          //spriteBatch.End();
             *
             #endregion
             *
             #region JESUS IS LORD <<< GRAPHICS >>> DRAW SPRITES
             *          /*
             *          //DRAWS THE SPRITES! JESUS IS LORD!
             *          // spriteBatch.Begin();
             *          spriteBatch.Draw(goku[0], gokuRect, Color.White);
             *          spriteBatch.Draw(superman[0], supermanRect, Color.White);
             *          //  spriteBatch.End();
             *          // TODO: Add your drawing code here
             * */
            /*
             #endregion
             #region JESUS IS LORD <<< GRAPHICS >>> dRAW EFFEECTS ON THE SCREEN
             * /*
             * spriteBatch.Draw(blueLight, blueRect, Color.White);
             * spriteBatch.Draw(redLight, redRect, Color.White);
             *
             * */
            // #endregion



            /*
             * if (displayEndScenes)
             *
             #region JESUS IS LORD <<< GRAPHICS>>> DRAW WORDS ON THE SCREEN
             * spriteBatch.DrawString(font, "WHAT I SEE IS TRUTH THE GAME", new Vector2(0, 450), Color.White);
             * spriteBatch.DrawString(font, "GOAL: CLEAR ALL THE BLOCKS ON THE SCREEN BY TOUCHING THEM!", new Vector2(0, 375), Color.White);
             * spriteBatch.DrawString(font, "MAKE SURE YOU REALIEZ THAT YOU MUST CHOOSE A NEW COLOR EACH TIME!", new Vector2(0, 400), Color.White);
             * spriteBatch.DrawString(font, "HIT ENTER TO START GAME!!!!", new Vector2(0, 470), Color.White);
             #endregion
             *
             *
             * {
             * */


            // spriteBatch.DrawString(font2, "HIT 4 TO SEE THE GREAT KUN-FU ENDING!", new Vector2(150, 300), Color.White);

            //   }

            //  LeapComponet[] leaparray = list.ToArray();

            //    leapfingersrect[0].X = (int)Game1.leapa.FingerPoints[0].X;
            //    leapfingersrect[0].Y = (int) Game1.leapa.FingerPoints[0].Y;
            //  leapfingersrect[0].X = (int)Game1.leapa.FirstHandLoc.X;
            //  leapfingersrect[0].Y = (int)Game1.leapa.FirstHandLoc.Y;

            //leapfingersrect[] = Game1.leapa.FingerPoints.ToArray;
            // leapfingersrect[1].Y = (int)Game1.leapa.FingerPoints[2].Y;

            /*
             *          leapfingersrect[2].X = (int)Game1.leapa.FingerPoints[2].X;
             *         leapfingersrect[2].Y = (int)Game1.leapa.FingerPoints[2].Y;
             *
             *          leapfingersrect[3].X = (int)Game1.leapa.FingerPoints[3].X;
             *          leapfingersrect[3].Y = (int)Game1.leapa.FingerPoints[3].Y;
             *
             *          leapfingersrect[4].X = (int)Game1.leapa.FingerPoints[4].X;
             *          leapfingersrect[4].Y = (int)Game1.leapa.FingerPoints[4].Y;
             *
             *          leapfingersrect[5].X = (int)Game1.leapa.FingerPoints[5].X;
             *          leapfingersrect[5].Y = (int)Game1.leapa.FingerPoints[5].Y;
             *          spriteBatch.Draw(texture, leapfingersrect[0], Color.White);
             *          spriteBatch.Draw(texture, leapfingersrect[1], Color.White);
             *          spriteBatch.Draw(texture, leapfingersrect[2], Color.White);
             *          spriteBatch.Draw(texture, leapfingersrect[3], Color.White);
             *          spriteBatch.Draw(texture, leapfingersrect[4], Color.White);
             * */
            // spriteBatch.Draw(texture, leapfingersrect[0], Color.White);
            //spriteBatch.Draw(texture, leapfingersrect[1], Color.White);

            /*  for (int a = 0; a < 5; a++)
             *    {
             *        spriteBatch.Draw(texture, , Color.White);
             *    }*/

            Vector2[] a = new Vector2[10];
            //   a = Game1.leapa.FingerPoints.ToArray();
            //a =  Game1.leapa.FingerPoints.ToArray<Vector2>;
            // a = new Vector2[Game1.leapa.FingerPoints.Count];
            // for (int f = 0; f < 5; f++)
            //{
            //    a = new Vector2[f];
            // }
            int i = 0;

            /*       foreach (Vector2 fingerLoc in Game1.leapa.FingerPoints)
             *     {
             *         a[i++] = fingerLoc;
             *     }
             *
             *
             *     spriteBatch.Draw(fingertextures[0], Game1.leapa.Fingerarray[0], Color.White);
             *
             *     spriteBatch.Draw(fingertextures[1], Game1.leapa.Fingerarray[1], Color.White);
             *
             *
             *     spriteBatch.Draw(fingertextures[2], Game1.leapa.Fingerarray[2], Color.White);
             *
             *     spriteBatch.Draw(fingertextures[3], Game1.leapa.Fingerarray[3], Color.White);
             *
             *     spriteBatch.Draw(fingertextures[4], Game1.leapa.Fingerarray[4], Color.White);
             *
             * */
            //  spriteBatch.DrawString(font, a[0].ToString(), new Vector2(200, 200), Color.White);
            //spriteBatch.Draw(texture, a[Game1.leapa.FingerPoints.Count-1], Color.White);

            /*
             * foreach (Vector2 fingerLoc in Game1.leapa.FingerPoints)
             * {
             *
             *
             * spriteBatch.Draw(texture, fingerLoc, Color.White);
             *  spriteBatch.Draw(texture, Game1.leapa.FirstHandLoc, Color.White);
             *
             *
             *
             * }*/
        }
コード例 #9
0
        /// <summary>
        /// Display context.Map with parallax backgrounds
        /// </summary>
        /// <param name="bg"></param>
        /// <param name="gameTime"></param>
        protected void DrawMap(ScrollingBackground bg, GameTime gameTime)
        {
            if (bg == null) return;

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            bg.Draw(spriteBatch);
            spriteBatch.End();
        }