diff --git a/assets/Misc/katIncluded.mp3 b/assets/Misc/katIncluded.mp3 new file mode 100644 index 0000000..9bd0b50 Binary files /dev/null and b/assets/Misc/katIncluded.mp3 differ diff --git a/assets/Misc/tutorial.png b/assets/Misc/tutorial.png new file mode 100644 index 0000000..b1725e4 Binary files /dev/null and b/assets/Misc/tutorial.png differ diff --git a/assets/Misc/tutorialsound.mp3 b/assets/Misc/tutorialsound.mp3 new file mode 100644 index 0000000..ea17f8f Binary files /dev/null and b/assets/Misc/tutorialsound.mp3 differ diff --git a/core/src/com/boomchess/game/BoomChess.java b/core/src/com/boomchess/game/BoomChess.java index 1305dd5..2b05899 100644 --- a/core/src/com/boomchess/game/BoomChess.java +++ b/core/src/com/boomchess/game/BoomChess.java @@ -121,9 +121,9 @@ public class BoomChess extends ApplicationAdapter { // universal Buttons -- here for music and sound control - public static Button playButton; + public static TextButton playButton; - public static Button muteButton; + public static TextButton muteButton; public static Button skipButton; @@ -276,6 +276,14 @@ public class BoomChess extends ApplicationAdapter { // ----------------------------------------------------------------------------------------- + // tutorial and loading screen + + public static Sound katIncluded; + public static Music tutorialSound; + + public static Texture tutorialTexture; + public static boolean inTutorial = false; + @Override public void create() { @@ -287,6 +295,8 @@ public void create() { loadingScreenTextures = new RandomImage(); loadingScreenTextures.addTexture("loadingScreen/loadingScreen2.png"); loadingSound = Gdx.audio.newSound(Gdx.files.internal("sounds/countdown.mp3")); + tutorialSound = Gdx.audio.newMusic(Gdx.files.internal("Misc/tutorialsound.mp3")); + tutorialTexture = new Texture(Gdx.files.internal("Misc/tutorial.png")); loadingStage = LoadingScreenStage.initalizeUI(); // creating all stage objects @@ -312,6 +322,7 @@ public void create() { background = new Texture(Gdx.files.internal("backgrounds/background_5.png")); boomSoftwares = Gdx.audio.newSound(Gdx.files.internal("Misc/BoomSoftwares.mp3")); + katIncluded = Gdx.audio.newSound(Gdx.files.internal("Misc/katIncluded.mp3")); loadingScreenIsRunning = true; } @@ -782,9 +793,9 @@ private static void loadAllAssets(){ // ---------------------------- universal Buttons for adding to stages - playButton = new Button(skin, "music"); + playButton = new TextButton("Play", skin); - muteButton = new Button(skin, "sound"); + muteButton = new TextButton("Mute", skin); skipButton = new TextButton("skip", skin); @@ -807,9 +818,15 @@ public void clicked(InputEvent event, float x, float y) { // if in game state - play background_music if (currentState != GameState.NOT_IN_GAME) { if(background_music.isPlaying()) { + if(inTutorial) { + tutorialSound.stop(); + } background_music.stop(); background_music.setVolume(0); } else { + if(inTutorial) { + tutorialSound.play(); + } background_music.play(); background_music.setVolume(volume); } @@ -830,6 +847,7 @@ public void clicked(InputEvent event, float x, float y) { public void clicked(InputEvent event, float x, float y) { // if in game state - play background_music if (volume == 0) { + tutorialSound.setVolume(1); volume = 0.1f; soundVolume = 0.1f; volumeSlider.setValue(0.1f); @@ -840,6 +858,7 @@ public void clicked(InputEvent event, float x, float y) { menu_music.setVolume(volume); } } else { + tutorialSound.setVolume(0); volume = 0; soundVolume = 0; volumeSlider.setValue(0); @@ -1323,6 +1342,7 @@ public static void createMainMenuStage() { /* * method for creating the stage for the main menu */ + inTutorial = false; switchToStage(MenuStage.initializeUI()); gameEndStage.clear(); } diff --git a/core/src/com/boomchess/game/backend/Board.java b/core/src/com/boomchess/game/backend/Board.java index 2661a67..0c19b0d 100644 --- a/core/src/com/boomchess/game/backend/Board.java +++ b/core/src/com/boomchess/game/backend/Board.java @@ -699,6 +699,48 @@ public static void initialiseChallengeFifteen(){ } */ + public static void initialiseTutorialBoard(){ + // declaring the board + + board = new Soldier[9][8]; + + // initialize the board with the correct pieces for the 2.Challenge + + // green red + // 0 1 2 3 4 5 6 7 8 + // 0 o + // 1 o + // 2 + // 3 g a i i g + // 4 + // 5 o + // 6 o + // 7 + + // start of the creation of the board + + // infantry + board[3][3] = new Infantry("green"); + board[6][3] = new Infantry("red"); + + // generals + board[1][3] = new General("green"); + board[7][3] = new General("red"); + + // artillery + board[2][3] = new Artillery("green"); + + // obstacles + board[2][1] = new Hill("empty"); + board[5][0] = new Hill("empty"); + board[4][5] = new Hill("empty"); + board[0][6] = new Hill("empty"); + + + // empty tiles ( all unused ones ) + fillNullOfEmptyTiles(); + } + // ----------------------------------- private static void fillNullOfEmptyTiles() { diff --git a/core/src/com/boomchess/game/frontend/stage/ChallengeStage.java b/core/src/com/boomchess/game/frontend/stage/ChallengeStage.java index 072d8f4..bb1d371 100644 --- a/core/src/com/boomchess/game/frontend/stage/ChallengeStage.java +++ b/core/src/com/boomchess/game/frontend/stage/ChallengeStage.java @@ -85,7 +85,7 @@ public void changed(ChangeListener.ChangeEvent event, Actor actor) { // button to start the third challenge TextButton challenge3Button = new TextButton("Challenge 3: Artillery Hell", skin); root.add(challenge3Button).padBottom(tileSize/4); - challenge2Button.addListener(new ChangeListener() { + challenge3Button.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) { diff --git a/core/src/com/boomchess/game/frontend/stage/GameStage.java b/core/src/com/boomchess/game/frontend/stage/GameStage.java index b6fe136..9e4ead8 100644 --- a/core/src/com/boomchess/game/frontend/stage/GameStage.java +++ b/core/src/com/boomchess/game/frontend/stage/GameStage.java @@ -292,6 +292,15 @@ public void dragStop(InputEvent event, float x, float y, int pointer) { gameStage.addActor(root); + if(inTutorial){ + // add tutorialtexture to the upper right corner + Image tutorialTexture = new Image(BoomChess.tutorialTexture); + tutorialTexture.setSize(tileSize*6, tileSize*7); + tutorialTexture.setPosition(Gdx.graphics.getWidth() - tutorialTexture.getWidth(), + Gdx.graphics.getHeight() - tutorialTexture.getHeight()); + gameStage.addActor(tutorialTexture); + } + // create another table for the option buttons diff --git a/core/src/com/boomchess/game/frontend/stage/MenuStage.java b/core/src/com/boomchess/game/frontend/stage/MenuStage.java index a9c32a9..90e92cc 100644 --- a/core/src/com/boomchess/game/frontend/stage/MenuStage.java +++ b/core/src/com/boomchess/game/frontend/stage/MenuStage.java @@ -40,14 +40,38 @@ public static Stage initializeUI() { root.add(title).top().padBottom(tileSize/4); root.row(); - TextButton helpButton = new TextButton("Help!", skin); - root.add(helpButton).padBottom(tileSize/4); - // if help button is pressed, create a new stage for the help information - helpButton.addListener(new ChangeListener() { + TextButton TutorialButton = new TextButton("Tutorial", skin); + root.add(TutorialButton).padBottom(tileSize/4); + TutorialButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { - // switch showHelp, if on, turn off, if off, turn on - createHelpStage(); + /* + * method for starting the tutorial + */ + + // stop menu music and start background_music + menu_music.stop(); + background_music.play(); + background_music.setVolume(0.05f); + + currentState = GameState.GREEN_TURN; + + isBotMatch = true; + + // create the first gameBoard + Board.initialiseTutorialBoard(); + + showArm = true; + + inGame = true; + + botDifficulty = "medium"; + + inTutorial = true; + + switchToStage(GameStage.createGameStage(isBotMatch)); + + BoomChess.tutorialSound.play(); } }); root.row(); diff --git a/core/src/com/boomchess/game/frontend/stage/OptionsStage.java b/core/src/com/boomchess/game/frontend/stage/OptionsStage.java index 507faf5..8356da8 100644 --- a/core/src/com/boomchess/game/frontend/stage/OptionsStage.java +++ b/core/src/com/boomchess/game/frontend/stage/OptionsStage.java @@ -19,11 +19,12 @@ public static Stage initalizeUI() { final Table root = new Table(); root.setFillParent(true); + root.row().padBottom(tileSize/3); // button to change bot difficulty // text that displays a text saying "Bot Difficulty" String currentDif = botDifficulty; final TextButton botDifficultyText = new TextButton("Bot Difficulty: " + currentDif, skin); - root.add(botDifficultyText).padBottom(tileSize/8); + root.add(botDifficultyText); botDifficultyText.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { @@ -41,7 +42,7 @@ public void changed(ChangeEvent event, Actor actor) { BoomChess.createOptionsStage(); } }); - root.row(); + root.row().padBottom(tileSize/3); // Change Mode button to switch medieval and modern String currentGameMode; @@ -52,7 +53,7 @@ public void changed(ChangeEvent event, Actor actor) { currentGameMode = "Modern"; } TextButton modeGameButton = new TextButton("Switch Mode: " + currentGameMode, skin); - root.add(modeGameButton).padBottom(tileSize/8); + root.add(modeGameButton); modeGameButton.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) { @@ -69,25 +70,55 @@ public void changed(ChangeListener.ChangeEvent event, Actor actor) { BoomChess.createOptionsStage(); } }); - root.row(); + root.row().padBottom(tileSize/3); // text that displays a text saying "Number of Obstacles" - final TextButton numberObstaclesText = new TextButton("Number of Obstacles 0-10", skin); - root.add(numberObstaclesText).padBottom(tileSize/12); - root.row(); - - // slider for setting the number of obstacles in the initial no mans land - final Slider obstacleSlider; - obstacleSlider = new Slider(0, 10, 1f, false, skin); - obstacleSlider.setValue(numberObstacle); - root.add(obstacleSlider).padBottom(tileSize/8); - obstacleSlider.addListener(new ChangeListener() { + final TextButton numberObstaclesText = new TextButton( + "Change Number of Obstacles: " + numberObstacle, skin); + numberObstaclesText.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { - BoomChess.numberObstacle = obstacleSlider.getValue(); + switch ((int) numberObstacle) { + case 0: + numberObstacle = 1; + break; + case 1: + numberObstacle = 2; + break; + case 2: + numberObstacle = 3; + break; + case 3: + numberObstacle = 4; + break; + case 4: + numberObstacle = 5; + break; + case 5: + numberObstacle = 6; + break; + case 6: + numberObstacle = 7; + break; + case 7: + numberObstacle = 8; + break; + case 8: + numberObstacle = 9; + break; + case 9: + numberObstacle = 10; + break; + case 10: + numberObstacle = 0; + break; + } + BoomChess.createOptionsStage(); } }); - root.row(); + root.add(numberObstaclesText); + + root.row().padBottom(tileSize/3);; // Change Mode button to switch blue and green String currentMode; @@ -98,7 +129,7 @@ public void changed(ChangeEvent event, Actor actor) { currentMode = "Green"; } TextButton modeButton = new TextButton("Switch 1.Player Colour: " + currentMode, skin); - root.add(modeButton).padBottom(tileSize/8); + root.add(modeButton); modeButton.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) { @@ -106,7 +137,7 @@ public void changed(ChangeListener.ChangeEvent event, Actor actor) { BoomChess.createOptionsStage(); } }); - root.row(); + root.row().padBottom(tileSize/3); // button to change the beep mode of the speech bubbles isBeepMode true or false String currentBeepMode; @@ -117,7 +148,7 @@ public void changed(ChangeListener.ChangeEvent event, Actor actor) { currentBeepMode = "Battlefield"; } TextButton beepModeButton = new TextButton("Speech Bubbles: " + currentBeepMode, skin); - root.add(beepModeButton).padBottom(tileSize/8); + root.add(beepModeButton); beepModeButton.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) { @@ -125,12 +156,11 @@ public void changed(ChangeListener.ChangeEvent event, Actor actor) { BoomChess.createOptionsStage(); } }); - root.row(); + root.row().padBottom(tileSize/3); // button for turning the arm on and off - root.row().padBottom(tileSize/8); TextButton armButton = new TextButton("BotArm: " + showArm, skin); - root.add(armButton).padBottom(tileSize/8); + root.add(armButton); armButton.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { @@ -138,13 +168,11 @@ public void changed(ChangeEvent event, Actor actor) { createOptionsStage(); } }); - - root.row(); - + root.row().padBottom(tileSize/3); // back button to return to the main menu TextButton backButton = new TextButton("Back", skin); - root.add(backButton).padBottom(tileSize/8); + root.add(backButton); backButton.addListener(new ChangeListener() { @Override public void changed(ChangeListener.ChangeEvent event, Actor actor) {