Esempio n. 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font        = Content.Load <SpriteFont>("Courier New");
            snapshot    = new StateSnapshot();
            soundPlayer.InitSoundLibrary(Content);
            scoreLabel = new TextObject("Score: " + score, font, Color.Black, false);

            t_ball          = this.Content.Load <Texture2D>("Ball");
            t_block         = this.Content.Load <Texture2D>("Block");
            t_paddle        = this.Content.Load <Texture2D>("Paddle");
            WinScreen       = this.Content.Load <Texture2D>("WinScreen");
            LoseScreen      = this.Content.Load <Texture2D>("LoseScreen");
            StartScreen     = this.Content.Load <Texture2D>("StartScreen");
            HighScoreScreen = this.Content.Load <Texture2D>("HighScoreScreen");

            paddle          = new Sprite(t_paddle, new Vector2(0, graphics.GraphicsDevice.Viewport.Height - t_paddle.Height));
            paddle.PhysType = PhysicsTransform.PhysicsType.Solid;

            controller = new SpriteController(paddle);

            console = new Assgn01.Console(graphics.GraphicsDevice, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height);

            ball = new Sprite(t_ball,
                              new Vector2(graphics.GraphicsDevice.Viewport.Width / 2 - t_ball.Width, graphics.GraphicsDevice.Viewport.Height / 2 - t_ball.Height)
                              , PhysicsTransform.PhysicsType.Elastic, true);
            ball.Velocity = new Vector2(0, 0.3f);

            gameStarted = false;
            gameOver    = true;
            soundPlayer.LoopMusic("BG1");
            //ResetGame();
        }
Esempio n. 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("Courier New");
            snapshot = new StateSnapshot();
            soundPlayer.InitSoundLibrary(Content);
            scoreLabel = new TextObject("Score: " + score, font, Color.Black, false);

            t_ball = this.Content.Load<Texture2D>("Ball");
            t_block = this.Content.Load<Texture2D>("Block");
            t_paddle = this.Content.Load<Texture2D>("Paddle");
            WinScreen = this.Content.Load<Texture2D>("WinScreen");
            LoseScreen = this.Content.Load<Texture2D>("LoseScreen");
            StartScreen = this.Content.Load<Texture2D>("StartScreen");
            HighScoreScreen = this.Content.Load<Texture2D>("HighScoreScreen");

            paddle = new Sprite(t_paddle, new Vector2(0, graphics.GraphicsDevice.Viewport.Height - t_paddle.Height));
            paddle.PhysType = PhysicsTransform.PhysicsType.Solid;

            controller = new SpriteController(paddle);

            console = new Assgn01.Console(graphics.GraphicsDevice, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height);

            ball = new Sprite(t_ball,
                                    new Vector2(graphics.GraphicsDevice.Viewport.Width / 2 - t_ball.Width, graphics.GraphicsDevice.Viewport.Height / 2 - t_ball.Height)
                                    , PhysicsTransform.PhysicsType.Elastic, true);
            ball.Velocity = new Vector2(0, 0.3f);

            gameStarted = false;
            gameOver = true;
            soundPlayer.LoopMusic("BG1");
            //ResetGame();
        }