Beispiel #1
0
        // Fontion pour afficher le jeu
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Transparent);

            Player player = (Player)entities[PLAYER_INDEX];

            spriteBatch.Begin(); //Début du dessin

            if (!gameover)
            {
                map.Draw(spriteBatch);
                foreach (Entity e in entities)
                {
                    e.Draw(spriteBatch);
                }
                spriteBatch.DrawString(font, "LIVES : " + player.Lives.ToString() + " SCORE : " + player.Score.ToString(), new Vector2(5, 0), Color.White);
            }
            else
            {
                spriteBatch.Draw(gameoverTexture, Vector2.Zero, Color.White);
                spriteBatch.DrawString(font, "SCORE : " + player.Score.ToString(), new Vector2(100, 320), Color.White);
            }

            spriteBatch.End(); //Fin du dessin

            base.Draw(gameTime);
        }
Beispiel #2
0
        public void Play()
        {
            Console.CursorVisible = false;
            Map.Draw(6, 20);
            PacMan.Draw(Map);

            for (int i = 0; i < Monsters.Count; i++)
            {
                Monsters[i].Draw(Map);
            }

            TimerStartGame();
            bool win = false;

            do
            {
                //----------------------------------------------------------------//

                /* for (int i = 0; i < Map.SizeY; i++)
                 * {
                 *   ConsoleLib.GotoXY(80, 6 + i);
                 *   for (int j = 0; j < Map.SizeX; j++)
                 *   {
                 *       Console.Write(Map.GetPointInMap(i, j));
                 *   }
                 * }*/
                //-----------------------------------------------------------------//
                PacManMove();
                if (ExitFromGame == true)
                {
                    break;
                }
                MonsterMove();

                ConsoleLib.GotoXY(1, 1);                                     /// на посмотреть
                Console.WriteLine("point count : {0}", ThePoint.PointCount); // на посмотреть

                ConsoleLib.GotoXY(20, 5);                                    // вывод рекорда на посмотреть
                Console.Write("score :: {0}", PacMan.Score);

                if (ThePoint.PointCount < 3)
                {
                    win = WinCheck();
                }
            } while (((ThePoint.PointCount + TheSuperPoint.SuperPointCount) != 0 || win != true) && PacMan.Life != 0);
        }
Beispiel #3
0
        /// <summary>
        /// Draw everything associated with the game class
        /// </summary>
        /// <param name="e"></param>
        public void Draw(PaintEventArgs e)
        {
            // Draw the map
            mMap.Draw(e);

            // Draw all characters
            for (int i = 0; i < mCharacters.Count; i++)
            {
                mCharacters[i].Draw(e);
            }

            // Draw the score text
            e.Graphics.DrawString(
                "Score: " + (mMap.GetMaxFood() - mMap.GetFoodLeft()).ToString() + "/" + mMap.GetMaxFood().ToString(),
                new Font("Arial", 16),
                new SolidBrush(Color.White),
                new Point(10, 10));
        }
Beispiel #4
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin(SpriteSortMode.BackToFront);

            map.Draw(gameTime, spriteBatch);

            //console.PrintPositions(pacman, enemies, spriteBatch);
            //console.PrintWay(enemies, spriteBatch);
            console.PrintScore(pacman, spriteBatch);

            if (gameEnd)
            {
                console.PrintGameOver(pacman.Lives, spriteBatch);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }