Hi,
I try to make a little harry potter quiz game for my girlfriend.
If someone want to test it (at the moment without music and only with german questions):
Click here
Screenshots:
It's ready so far but I have 2 little questions:
When I use music and call System.exit(0); ,
the program is shut down but java is still running ...
Without the music everything works fine.
Code:
/** the main music from the HarryPotter film */
private Music mainTheme;
...
public void update(GameContainer gameContainer, StateBasedGame stateBasedgame, int delta) throws SlickException {
...
if (LoadingList.get().getRemainingResources() > 0) {
nextResource = LoadingList.get().getNext();
} else {
if (!bStarted) {
bStarted = true;
this.mainTheme.loop();
}
}
}
...
public void mouseReleased( int button, int newX, int newY ) {
if ( button == 0 ) {
for ( int i = 0; i < this.buttons.length; i++ ) {
if ( this.buttons[i].getReleased( newX, newY ) ) {
String function = this.buttons[i].getFunction();
if ( "Exit".equals( function ) ) {
System.exit( 0 );
break;
}
}
}
}
}
...
public void enter(GameContainer container, StateBasedGame game) throws SlickException
{
super.enter(container, game);
if(this.mainTheme == null)
{
this.mainTheme = new Music( "sounds/mainTheme.xm" );
}
}
And my last question:
I want to use an icon, but nothing works ...
Code:
game.setIcons(new String[] {"images/icon.png", "images/icon24.png"});
Is there anything special to do I didn't notice???