Пример #1
0
        public Screen(ContentManager theContent, Viewport theViewport, EventHandler theScreenEvent)
        {
            mViewport = theViewport;
            mContent = theContent;

            ScreenEvent = theScreenEvent;

            mSafeArea = new SafeArea(theContent);
        }
Пример #2
0
        public Screen(ContentManager theContent, Viewport theViewport, EventHandler theScreenEvent)
        {
            mViewport = theViewport;
            mContent  = theContent;

            ScreenEvent = theScreenEvent;

            mSafeArea = new SafeArea(theContent);
        }
Пример #3
0
        //ContentManager mContent;
        //Viewport mViewport;

        public Gameplay(ContentManager theContent, Viewport theViewport, EventHandler theScreenEvent, PlayerIndex thePlayerOne, PlayerIndex thePlayerTwo)
            : base(theContent, theViewport, theScreenEvent)
        {
            GraphicsDeviceClearColor = Color.SlateGray;

            mContent  = theContent;
            mViewport = theViewport;


            mBall = new Ball(theContent, "Sprites/Ball");

            mBackground = new Sprite(theContent, "Sprites/PongBackground");

            mPlayerOneScore = new Text(theContent, "Player One", "Fonts/ScoreFont", new Vector2(550, 75), Color.White);
            mPlayerTwoScore = new Text(theContent, "Player Two", "Fonts/ScoreFont", new Vector2(700, 75), Color.White);

            mPlayerOneScoredText = new Text(theContent, "Player One Scored!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mPlayerOneScoredText.Center(new Rectangle(0, 0, 1280, 670), Text.Alignment.Both);

            mPlayerTwoScoredText = new Text(theContent, "Player Two Scored!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mPlayerTwoScoredText.Center(new Rectangle(0, 0, 1280, 670), Text.Alignment.Both);

            mStartText = new Text(theContent, "Get ready to begin!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mStartText.Center(new Rectangle(0, 0, 1280, 720), Text.Alignment.Both);

            mGetReadyText = new Text(theContent, "Get ready!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mGetReadyText.Center(new Rectangle(0, 0, 1280, 720), Text.Alignment.Both);
            mGetReadyText.Position.Y += 50;

            mPlayerOneWins = new Text(theContent, "Player One Wins!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mPlayerOneWins.Center(new Rectangle(0, 0, 1280, 720), Text.Alignment.Both);

            mPlayerTwoWins = new Text(theContent, "Player Two Wins!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mPlayerTwoWins.Center(new Rectangle(0, 0, 1280, 720), Text.Alignment.Both);

            //mSquare = new Sprite(Content, "Square");
            //mSquare.Scale = new Vector2(750, 250);
            //mSquare.Position = mSquare.Center(new Rectangle(0, 0, 1280, 720));

            mMessageBox          = new Sprite(theContent, "Sprites/MessageBox");
            mMessageBox.Position = mMessageBox.Center(new Rectangle(0, 0, 1280, 720));

            mSafeArea = new SafeArea(theContent);

            mBackgroundMusic = theContent.Load <Song>("SoundFX/Pong");
            MediaPlayer.Play(mBackgroundMusic);
            MediaPlayer.IsRepeating = true;

            mGameOver = theContent.Load <SoundEffect>("SoundFX/GameOver");
            mScore    = theContent.Load <SoundEffect>("SoundFX/Score001");
        }
Пример #4
0
        //ContentManager mContent;
        //Viewport mViewport;
        public Gameplay(ContentManager theContent, Viewport theViewport, EventHandler theScreenEvent,  PlayerIndex thePlayerOne, PlayerIndex thePlayerTwo)
            : base(theContent, theViewport, theScreenEvent)
        {
            GraphicsDeviceClearColor = Color.SlateGray;

            mContent = theContent;
            mViewport = theViewport;

            mBall = new Ball(theContent, "Sprites/Ball");

            mBackground = new Sprite(theContent, "Sprites/PongBackground");

            mPlayerOneScore = new Text(theContent, "Player One", "Fonts/ScoreFont", new Vector2(550, 75), Color.White);
            mPlayerTwoScore = new Text(theContent, "Player Two", "Fonts/ScoreFont", new Vector2(700, 75), Color.White);

            mPlayerOneScoredText = new Text(theContent, "Player One Scored!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mPlayerOneScoredText.Center(new Rectangle(0, 0, 1280, 670), Text.Alignment.Both);

            mPlayerTwoScoredText = new Text(theContent, "Player Two Scored!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mPlayerTwoScoredText.Center(new Rectangle(0, 0, 1280, 670), Text.Alignment.Both);

            mStartText = new Text(theContent, "Get ready to begin!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mStartText.Center(new Rectangle(0, 0, 1280, 720), Text.Alignment.Both);

            mGetReadyText = new Text(theContent, "Get ready!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mGetReadyText.Center(new Rectangle(0, 0, 1280, 720), Text.Alignment.Both);
            mGetReadyText.Position.Y += 50;

            mPlayerOneWins = new Text(theContent, "Player One Wins!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mPlayerOneWins.Center(new Rectangle(0, 0, 1280, 720), Text.Alignment.Both);

            mPlayerTwoWins = new Text(theContent, "Player Two Wins!", "Fonts/ScoreFont", new Vector2(0, 0), Color.DarkBlue);
            mPlayerTwoWins.Center(new Rectangle(0, 0, 1280, 720), Text.Alignment.Both);

            //mSquare = new Sprite(Content, "Square");
            //mSquare.Scale = new Vector2(750, 250);
            //mSquare.Position = mSquare.Center(new Rectangle(0, 0, 1280, 720));

            mMessageBox = new Sprite(theContent, "Sprites/MessageBox");
            mMessageBox.Position = mMessageBox.Center(new Rectangle(0, 0, 1280, 720));

            mSafeArea = new SafeArea(theContent);

            mBackgroundMusic = theContent.Load<Song>("SoundFX/Pong");
            MediaPlayer.Play(mBackgroundMusic);
            MediaPlayer.IsRepeating = true;

            mGameOver = theContent.Load<SoundEffect>("SoundFX/GameOver");
            mScore = theContent.Load<SoundEffect>("SoundFX/Score001");
        }