예제 #1
0
        /// <summary>
        /// Draws the game world
        /// </summary>
        /// <param name="gameTime">The game time</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();


            foreach (var coin in coins)
            {
                coin.Draw(gameTime, spriteBatch);

                /*
                 * var rect = new Rectangle((int)(coin.Bounds.Center.X - coin.Bounds.Radius),
                 *                       (int)(coin.Bounds.Center.Y - coin.Bounds.Radius),
                 *                       (int)(2*coin.Bounds.Radius), (int)(2*coin.Bounds.Radius));
                 * spriteBatch.Draw(ball, rect, Color.White);
                 */
            }

            /*
             * var rectG = new Rectangle((int)(slimeGhost.Bounds.Center.X - slimeGhost.Bounds.Radius),
             *           (int)(slimeGhost.Bounds.Center.Y - slimeGhost.Bounds.Radius),
             *           (int)(2 * slimeGhost.Bounds.Radius), (int)(2 * slimeGhost.Bounds.Radius));
             *
             * spriteBatch.Draw(ball, rectG, Color.White);
             */
            slimeGhost.Draw(gameTime, spriteBatch);
            spriteBatch.DrawString(spriteFont, $"Coins left: {coinsLeft}", new Vector2(2, 2), Color.Gold);
            spriteBatch.End();

            base.Draw(gameTime);
        }
예제 #2
0
        /// <summary>
        /// Draws the game world
        /// </summary>
        /// <param name="gameTime">The game time</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();
            foreach (var coin in coins)
            {
                coin.Draw(gameTime, spriteBatch);
            }
            slimeGhost.Draw(gameTime, spriteBatch);
            spriteBatch.DrawString(spriteFont, $"Coins left: {coinsLeft}", new Vector2(2, 2), Color.Gold);
            spriteBatch.End();

            base.Draw(gameTime);
        }