Imposter wrote:
They aren't required methods, so most likely you haven't put them in your state file. Like your init is going to hold your fuel right? Like the gas container of a car if that makes sense. It is always going to be there unless you get a new car and you can fill it up with so much. Your enter is like the gas pedal which requires the state to be opened to start the music when the state appears. Your leave method is like turning off your engine. Also instead of gas pedal lets say ignition. When you turn off your car you don't wanna continue hearing your engine right. Hopefully this source code will make more sense:
Code:
public void enter() {
<musicname>.loop(pitch, volume);
}
You don't need those 2 variables, but they are there if you wanna use them.
Code:
public void leave() {
<musicname>.stop();
}
This will tell us to stop playing the music when we aren't in the state. This isn't the best, but hopefully I kinda explained it to you.
No errors, but the music doesn't seem to play.
I have the music initialized in my variable list like so
Code:
Music openingMenuMusic;
I then have this in the init method
Code:
openingMenuMusic = new Music("res//music//through_the_valleys.ogg");
and then the 2 methods you've suggests done almost identically.
Am I not importing the music correctly?