I've been working though your guild however I have got to the part 2 (images, sound & text) and started the Drum Pad tutorial but I've ran in to a Error I can't fix.
----------------------------------------------------------------------------- Copy of my code ----------------------------------------------------------------------------- // Game World SoundEffect music; SoundEffectInstance musicInstance = null;
if (oldpad1.Buttons.LeftShoulder == ButtonState.Released && pad1.Buttons.LeftShoulder == ButtonState.Pressed) { // Start the music playing if (musicInstance == null) { // Need to create a SoundInstance to play the music. musicInstance = music.Play(); } else { // Already got a SoundInstance. Just play it. musicInstance.Play(); } } The error occars on "musicInstance = music.Play();" Error reads :- Cannot implicitly convert type 'bool' to 'Microsoft.Xna.Framework.Audio.SoundEffectInstance' C:\Documents and Settings\Home\Desktop\MoodLight Game project\DrumPad\DrumPad\Game1.cs 140
Hi. Sorry you are having problems. The issue is because the sound API changed in the latest version of XNA. To play a sound you no longer need a SoundInstance. You can just go:
Cheers for the reply, This as been the only problem I,ve had so far. Apart from that the guild is great, really easy to follow and I,ve learnt loads in a short time.
I chagned my code, its Build & deployed error free, HAPPY DAYS =)
I've been working though your guild however I have got to the part 2 (images, sound & text) and started the Drum Pad tutorial but I've ran in to a Error I can't fix.
-----------------------------------------------------------------------------
Copy of my code
-----------------------------------------------------------------------------
// Game World
SoundEffect music;
SoundEffectInstance musicInstance = null;
if (oldpad1.Buttons.LeftShoulder == ButtonState.Released &&
pad1.Buttons.LeftShoulder == ButtonState.Pressed)
{
// Start the music playing
if (musicInstance == null)
{
// Need to create a SoundInstance to play the music.
musicInstance = music.Play();
}
else
{
// Already got a SoundInstance. Just play it.
musicInstance.Play();
}
}
The error occars on "musicInstance = music.Play();" Error reads :- Cannot implicitly convert type 'bool' to 'Microsoft.Xna.Framework.Audio.SoundEffectInstance' C:\Documents and Settings\Home\Desktop\MoodLight Game project\DrumPad\DrumPad\Game1.cs 140
Please help.