big problem, need help

pjnolenpjnolen Member Posts: 152
edited November -1 in Working with GS (Mac)
Ok, i had a problem with background music not working properly, but i couldn't figure out how to fix it and no one else had any ideas, so i tried to just change the scene in order to solve the problem.

The original problem was having background music play on the main menu scene. When you press a button to go to another scene, such as difficulty options, or sound options the music continues just fine. But when you go BACK to the main menu scene, the music resets, and it will keep doing that every time you go back to that main menu scene. The music needs to play uninterrupted until you leave the menus and go into the game, but it won't and no one can help me fix it, assuming it can be fixed.

Soooooo, i decided if the music resets every time i load the main menu scene, i'll just not reload it. I increased it's size, and when you press one of the buttons to go to another screen, instead, it just moves the present buttons off the screen, and moves onto the screen the new buttons. So press the 'sounds' button, and all the buttons leave the screen, and all the sound buttons move onto the screen. Press the back button(that moves onto the screen along with the sound options) and the sound buttons move off, and the main menu buttons move back on. This works, only halfassed.

If i press the sounds buttons, they'll come on and go off all day long, BUT if I then press the 'difficulty' button, the difficulty options will NOT enter the screen. They just don't move.

If I reset, and press the 'difficulty' button, those options come onto the screen just fine, BUT then the sound options won't enter the screen.

I have added a game attribute called 'start screen menus'
I have it setup where, when you press the 'sound' button, it's set to 1, and when it's set to 1 the sound options move onto the screen. Which works

When you press the 'back' button it sets it to 0, and when it's set to 0, the main menu buttons come back. Which works.

When you press the difficulty button, it sets it to 2, when it's set to 2, the difficulty options move on to the screen. Which works.

BUT I can only do ONE of those. Which ever one I press FIRST will work just fine over and over. But then I can't use the other one.

I think it has something to do with changing the 'start screen menu' attribute, but i have it already set when you press the 'back' button it changes it to 0, so every time you press a main menu button it should be changing it from 0 to either 1 or 2.

Just having a menu screen with some options on it should be the last thing i need to be smashing my head against the wall with, I've got the rest of the game to do, but clearly if I can't make the menu screen, I can't expect to finish the game.

I REALLY REALLY REALLY want to finish this, but I keep getting 90% through a section and hitting a brick wall, then from scratch redesigning it to go around that brick wall, and after 90% of that, hitting another brick wall.

Can I get some advice on getting this to work? I originally had a different scene for each main menu option, but threw it all away because the sound would keep resetting. Now i have 1 scene, but the buttons WONT reset.

There's got to be something I'm missing here. Help me out guys. I want to do a good job, see my game on the app store like everyone else, feel good about what I made and how I made it. If it's finished and working exactly how i wanted, then GS can have any splash screen they want!

Comments

  • forkliftforklift Member Posts: 386
    make a game level attribute (boolean) called MusicStarted. Set it to false (leave it at 0)

    When the game starts, have a rule controlling the music as:

    If MusicStarted = false, play musicfile, change game.MusicStarted to true.

    In other words, simply check each time you go back to the main menu if the music has already started, which it will have, so there's no need for the music to play again.
  • pjnolenpjnolen Member Posts: 152
    when you say, 'have a rule controlling the music as:"

    Do you mean, put this rule in an actor, and place that actor in the 'main menu' screen?

    If I do that, when I go 'back' to the main menu screen from the music options screen the music stops. It makes perfect sense that this rule would work, because the rule would from then on always be true, and therefore the music wouldn't be adjusted in any way.

    But when I go back to the main menu, it cuts the music off.
  • pjnolenpjnolen Member Posts: 152
    ok, i created a completely new game, with just 2 screens, and 2 buttons, and those rules

    and it works.

    So now I have to figure out why mine doesn't work and this one does.

    ARG.

    Thanks Forklift, if I can get this to work, then I will recreate all the scenes, again, from scratch, delete all the rules and attributes i had to make, and start over, again.

    I KNEW there was a way the first time I did it(similar to yours, but wrong), but I just couldn't figure it out.

    but........at least, with the help you gave, it will work.

    THANK YOU FORKLIFT
  • forkliftforklift Member Posts: 386
    Glad to help out. Sorry you have to gut your game to make the sound work. I would just take out all your rules that have to do with the music and replace them with the new rules we discussed. Hate to see somebody do an entire game over again just for the music rules.
  • pjnolenpjnolen Member Posts: 152
    well, i redigned the main menu to compensate for the sound not working, i think originally i had the rule setup to 'make music set to true, if true, then start music'

    instead of your 'if set to false, start music, then set to true'
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    issue I have with music is when I hit scene reset it kills the music. how do you get the music to play non-stop through scene resets?
  • pjnolenpjnolen Member Posts: 152
    did the method forklift stated not work?
  • forkliftforklift Member Posts: 386
    He's asking about the music stopping when resetting a scene. The problem is, resetting the scene only loads everything from the scene... and you probably loaded the music from the main menu.

    If reset button is pressed, change game.sound (boolean) to false.
    when scene starts, if game.sound = false, play music, change game.sound to true
Sign In or Register to comment.