added title screen

This commit is contained in:
2025-11-28 20:37:45 +01:00
parent 88c6f4be72
commit 5fbf815595
5 changed files with 78 additions and 4 deletions

View File

@@ -64,8 +64,8 @@ public class GamePanel extends JPanel implements Runnable {
public void setupGame() {
assetSetter.setObject();
assetSetter.setNPC();
playMusic(0); //Play main theme
gameState = GameState.PLAY;
//playMusic(0); //Play main theme
gameState = GameState.TITLE;
}
public void startGameThread() {
@@ -121,7 +121,13 @@ public class GamePanel extends JPanel implements Runnable {
long drawStart = 0;
drawStart = System.nanoTime();
// COMPONENTS
// TITLE SCREEN
if(gameState == GameState.TITLE) {
ui.draw(graphics2d);
return;
}
// GAME
tileM.draw(graphics2d);
for (SuperObject superObject : obj) if (superObject != null) superObject.draw(graphics2d, this);
for(Entity npc : npc) if(npc != null) npc.draw(graphics2d);