Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help needed with xna/c# error

Options
  • 07-03-2009 4:47pm
    #1
    Registered Users Posts: 6,521 ✭✭✭


    Hey making a game in xna for a project. Im implementing music at the minute.

    Basically I have a title screen no music once the player hit starts the game the music plays no problem. I have 3 lives and at first my music played continuously even if i died so i put in music.Stop(AudioStopOptions.AsAuthored); if my if statement when my lives are gone.

    When i die it send me back to the title screen but for somereason it throws up an error when i start the game again saying InvalidOperationException

    so even though the music.play works at the beginning when i die and am thrown back to the title screen it doesnt??

    protected void StartNewGame()
    {
    _GameStarted = 1;
    _LivesLeft = 3;
    player.ScrollRate = 0;
    _playerScore = 0;
    _GameWave = 0;
    music.Play();


    StartNewWave();
    }

    theres my startnewgamemethod that picks out the music.play as an error ONLY when i loose my 3 lives.

    if (_LivesLeft > 0)
    {
    PlayerKilled();

    StartNewWave();
    }
    else
    {
    music.Stop(AudioStopOptions.AsAuthored);
    _GameStarted = 0;
    _ProcessEvents = 1;
    }

    thats where i stop the music playing if i die.

    Can anyone help??


Comments

  • Closed Accounts Posts: 5,482 ✭✭✭Kidchameleon


    Are you updating your audio engine in the update member? Sounds like your just updating it at certain times... Can you post complete source?


Advertisement