Example #1
0
        /*
         * Randomly select a colour for the ball to be
         * */
        public void ResetColour()
        {
            int temp = generator.Next(4);
            if (temp == 0)
            {
                colour = Image.value.green;
            }

            else if (temp == 1)
            {
                colour = Image.value.purple;
            }

            else if (temp == 2)
            {
                colour = Image.value.blue;
            }

            else if (temp == 3)
            {
                colour = Image.value.red;
            }
        }
Example #2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (!core.GameOver())
            {
                // Allows the default game to exit on Xbox 360 and Windows
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                    this.Exit();

                colour = core.Update(gameTime, Keyboard.GetState(), GamePad.GetState(PlayerIndex.One));
                ballPos = core.getPos();

                if (blast) GamePad.SetVibration(PlayerIndex.One, 1.0f, 1.0f);
                if (blastTime > 0) blastTime--;
                if (blastTime == 0)
                {
                    blast = false;
                    GamePad.SetVibration(PlayerIndex.One, 0.0f, 0.0f);

                }
                ballGenerator.Update();
                ball.Update(gameTime);
                music.UpdateAudio();
                base.Update(gameTime);

                this.elapsedTime -= (float)gameTime.ElapsedGameTime.TotalSeconds;
                //Console.WriteLine(elapsedTime);
                if ((int)elapsedTime == 0)
                {
                    if (!specialModeOn)
                    {
                        core.NextSpecial();
                        specialModeOn = true;
                        theNextMode = "Normal Mode in:";
                        elapsedTime = 20;
                        music.pauseAllCues();

                        if (core.blackwhite)
                        {
                            music.SuspendThreads();
                            music.bwCue.Play();
                        }

                        if (core.searchLightOn)
                        {
                            music.SuspendThreads();
                            music.searchCue.Play();
                        }
                    }

                    else
                    {
                        core.ResetSpecial();
                        specialModeOn = false;
                        theNextMode = "Special Mode in:";
                        elapsedTime = 30;
                        music.resumeAllCues();
                        music.ResumeThreads();
                        music.disposeSpecialCues();
                        music.resetSpecialCues();
                    }

                }

                if (!specialModeOn)
                {
                    if (colour == Image.value.green)
                    {
                        music.setPosition(ballPos);
                        music.InstrChanger(Image.value.green);
                    }

                    if (colour == Image.value.blue)
                    {
                        music.setPosition(ballPos);
                        music.InstrChanger(Image.value.blue);
                    }

                    if (colour == Image.value.red)
                    {
                        music.setPosition(ballPos);
                        music.InstrChanger(Image.value.red);
                    }

                    if (colour == Image.value.purple)
                    {
                        music.setPosition(ballPos);
                        music.InstrChanger(Image.value.purple);
                    }
                }
            }

            if (core.GameOver())
            {
                if (gameOver.Position != new Vector2(640, 360))
                {
                    music.pauseAllCues();
                    music.SuspendThreads();

                    if (!music.gameOverCue.IsPlaying)
                    {
                        music.setPosition(ballPos);
                        music.deathCue.Apply3D(music.listener, music.emitter);
                        music.deathCue.Play();
                        music.gameOverCue.Play();
                    }

                    gameOver.Position = new Vector2(gameOver.Position.X, gameOver.Position.Y + 2);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the default game to exit on Xbox 360 and Windows
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

               colour = core.Update(gameTime, Keyboard.GetState(), GamePad.GetState(PlayerIndex.One));

               if (colour == Image.value.green)
               music.InstrChanger(Image.value.green);

               /* if (colour == Image.value.blue)
               music.InstrChanger(Image.value.blue); */

               if (colour == Image.value.red)
               music.InstrChanger(Image.value.red);

               if (colour == Image.value.purple)
               music.InstrChanger(Image.value.purple);

               ball.Update(gameTime);
               music.UpdateAudio();
               base.Update(gameTime);
        }
Example #4
0
        /// <summary>
        /// Method that regulates the modification of the song.
        /// </summary>
        public void ChangeMelody(Object colour)
        {
            ballColour = (Image.value)colour;
            ChangeBase();                                                                       // Base melody is modified every time balls are destroyed.

            // If the destoyed balls are blue
            if (ballColour == Image.value.blue)
            {
                // If the piano isn't playing
                if (!pianoCue1.IsPlaying && !pianoCue2.IsPlaying)
                {
                    // If there's a piano cue in memory, destroy it
                    if (pianoCue1 != null)
                    {
                        disposePianoCues();
                        resetPianoCues();
                    }

                    // Wait until the base melody has finished.
                    while (!baseCue1.IsStopped && !baseCue2.IsStopped)
                    {
                        // TO DO
                    }
                    pianoCue1.Play();                                                           // Play the piano now so that it is in sync.
                }

                // Modify the currently playing piano
                else
                    ChangePiano();
            }

            // If the destoyed balls are green
            if (ballColour == Image.value.green)
            {
                // If the strings aren't playing
                if (!stringCue1.IsPlaying && !stringCue2.IsPlaying && !stringCue3.IsPlaying && !stringCue4.IsPlaying)
                {
                    // If there's a string cue in memory, destroy it
                    if (stringCue1 != null)
                    {
                        disposeStringCues();
                        resetStringCues();
                    }

                    // Wait until the base melody has finished
                    while (!baseCue1.IsStopped && !baseCue2.IsStopped)
                    {
                        // TO DO
                    }
                    stringCue1.Play();                                                          // Play the piano now so that it is in sync.
                }

                // Modify the currently playing stringed instrument
                else
                    ChangeStrings();
            }

            // If the destoyed balls are red
            if (ballColour == Image.value.red)
            {
                // If the piano isn't playing
                if (!bellCue1.IsPlaying && !bellCue2.IsPlaying)
                {
                    // If there's a piano cue in memory, destroy it
                    if (bellCue1 != null)
                    {
                        disposeBellCues();
                        resetBellCues();
                    }

                    // Wait until the base melody has finished.
                    while (!baseCue1.IsStopped && !baseCue2.IsStopped)
                    {
                        // TO DO
                    }
                    bellCue1.Play();                                                           // Play the bell now so that it is in sync.
                }

                // Modify the currently playing piano
                else
                    ChangeBells();
            }
        }
Example #5
0
        /// <summary>
        /// Method that regulates the modification of the song.
        /// </summary>
        public void ChangeMelody(Object colour)
        {
            ballColour = (Image.value)colour;

            if (baseCue1.IsPlaying)
                cue = 1;

            if (baseCue2.IsPlaying)
                cue = 2;

            // Base melody is modified every time balls are destroyed.
            ChangeBase();

            // If the destoyed balls are blue
            if (ballColour == Image.value.blue)
            {
                // If the drums aren't playing
                if (!drumCue1.IsPlaying && !drumCue2.IsPlaying && !drumCue3.IsPlaying && !drumCue4.IsPlaying)
                {
                    // If there's a drum cue in memory, reset it
                    if (drumCue1 != null)
                        resetDrumCues();

                    if (cue == 1)
                        // Wait until the base melody has finished.
                        while (!baseCue1.IsStopped)
                        {}

                    else if (cue == 2)
                        // Wait until the base melody has finished.
                        while (!baseCue2.IsStopped)
                        {}

                    // Play the drums now so that it is in sync.
                    drumCue1.Play();
                }

                // Modify the currently playing drums
                else
                    ChangeDrums();
            }

            // If the destoyed balls are green
            if (ballColour == Image.value.green)
            {
                // If the strings aren't playing
                if (!stringCue1.IsPlaying && !stringCue2.IsPlaying && !stringCue3.IsPlaying && !stringCue4.IsPlaying)
                {
                    // If there's a string cue in memory, reset it
                    if (stringCue1 != null)
                        resetStringCues();

                    if (cue == 1)
                        // Wait until the base melody has finished.
                        while (!baseCue1.IsStopped)
                        { }

                    else if (cue == 2)
                        // Wait until the base melody has finished.
                        while (!baseCue2.IsStopped)
                        { }

                    // Play the strings now so that it is in sync.
                    stringCue1.Play();
                }

                // Modify the currently playing stringed instrument
                else
                    ChangeStrings();
            }

            // If the destoyed balls are red
            if (ballColour == Image.value.red)
            {
                // If the harp isn't playing
                if (!harpCue1.IsPlaying && !harpCue2.IsPlaying && !harpCue3.IsPlaying && !harpCue4.IsPlaying)
                {
                    // If there's a harp cue in memory, reset it
                    if (harpCue1 != null)
                        resetHarpCues();

                    if (cue == 1)
                        // Wait until the base melody has finished.
                        while (!baseCue1.IsStopped)
                        { }

                    else if (cue == 2)
                        // Wait until the base melody has finished.
                        while (!baseCue2.IsStopped)
                        { }

                    // Play the harp now so that it is in sync.
                    harpCue1.Play();
                }

                // Modify the currently playing harp
                else
                    ChangeHarp();
            }

            // If the destoyed balls are purple
            if (ballColour == Image.value.purple)
            {
                // If the synth isn't playing
                if (!synthCue1.IsPlaying && !synthCue2.IsPlaying && !synthCue3.IsPlaying && !synthCue4.IsPlaying)
                {
                    // If there's a synth cue in memory, destroy it
                    if (synthCue1 != null)
                        resetSynthCues();

                    if (cue == 1)
                        // Wait until the base melody has finished.
                        while (!baseCue1.IsStopped)
                        { }

                    else if (cue == 2)
                        // Wait until the base melody has finished.
                        while (!baseCue2.IsStopped)
                        { }

                    // Play the synth now so that it is in sync.
                    synthCue1.Play();
                }

                 // Modify the currently playing synth
                 else
                    ChangeSynth();
            }
        }