New Pause Menu & Player Guide Implementation - UQdeco2800/2022-studio-2 GitHub Wiki

Introduction

The player guide is an optimisation feature of the current game, the reason is that it is discovered that most of the player feel confused and stuck at level one and do not know what to do to craft weapons or where to go to find enimies. What is more, for those who took long periods of time to find level 2 entrance, many of them do not know how to win the game and how to unlock skills. Therefore, we have finally decided to implement this player guide feature in sprint 4, which at this stage, the game should be optimising and finalising. In this page, I will discuss how the player guide is implemented, I hope this can help you get a better understanding of GameAreaDisplay.java class. And how I integrated some previously implemented methods to achieve some functionalities. Note that pause menu implementation is a previously implemented feature, the fundamental logic does not vary, so it will only be briefly explained here. Additionally, some methods first created by me are then modified by @Issac.

If you are interested in the player guide design process and how user test is conducted, please refer to this page: Crafting Player Guide Visual Asset Design User Test

How to implement player guide?

Relevant method: setPlayerGuideMenu(String filePath), openPlayerGuide(int level, int pageNumber) Once the player guide assets are pushed to my working branch, my plan for implementing the player guide is to make changes on my previously implemented pause menu method. Firstly, i need to move all the previously definedtransparent texture to the new position according to the new pause menu format: imgonline-com-ua-twotoone-YnypZ84YY1DB

To achieve that, we simply just re-adjust the buttons positions:

resume.setSize(386f, 122.4f);
resume.setPosition(pauseMenu.getX() + 760f, pauseMenu.getY() + 576);

exit.setSize(386, 122.4f);
exit.setPosition(pauseMenu.getX() + 765f, pauseMenu.getY() + 288);

controls.setSize(386, 122.4f);
controls.setPosition(pauseMenu.getX() + 762f, pauseMenu.getY() + 382);

playerGuideBtn.setSize(386, 122.4f);
playerGuideBtn.setPosition(pauseMenu.getX() + 762f, pauseMenu.getY() + 482);

After the positioning is correct, we then look at creating a new menu under GameAreaDisplay.java. In this case, we define a class called setPlayerGuideMenu(String filePath), unlike traditional setPauseMenu(), this method takes in an filePath as input prarameter, we will discuss the use of this variable in the next section. But for now, in order to display two menus with different designs within two different level of map, we do:

new ChangeListener() {
      @Override
      public void changed(ChangeEvent changeEvent, Actor actor) {
          logger.info("Player guide button clicked");
          if (getGameAreaName().equals("Underground")) {
              openPauseComponent.openPlayerGuide(2,1);
          } else {
              openPauseComponent.openPlayerGuide(1,1);
          }
      }
});

Dealing with repetitious button clicks

Now when the player click on the player guide button on pause menu, they can successfully open the first page of player guide, but since our player guide has a side-bar navigation, the challenge now becomes dealing with player's repretitious button clicks and constantly jumping from pages. This is achieved using an external method in OpenPauseComponent.java called openPlayerGuide(int level, int pageNumber), this method is refined by Issac:

        if (pageNumber > 8) {
            logger.error("Invalid player guide page given");
            return false;
        }
        if (level == 1) {
            ServiceLocator.getPlayerGuidArea().setPlayerGuideMenu(playerGuideAssets.get(pageNumber - 1));
        } else if (level == 2) {
            ServiceLocator.getPlayerGuidArea().setPlayerGuideMenu(playerGuideAssetslevel2.get(pageNumber - 1));
        } else {
            logger.error("Invalid player guide level given");
            return false;
        }
        playerGuideOpen = true;
        logger.info("Turning to player guide level {} page {}", level, pageNumber);        
        return true;

The logic is to first define page numbers to each pages, and define 8 buttons for the 8 sections on the side-bar, once RTTM detected button click, then the page number and relative game level will be passed into the method. The method will then generat the relative filePath corresponds to the player guide page. For, example, if the player wants to know HowToCraft:

logger.info("HowToCraft clicked");
disposePlayerGuideMenu();
if (getGameAreaName().equals("Underground")) {
    openPauseComponent.openPlayerGuide(2,1);
} else {
    openPauseComponent.openPlayerGuide(1,1);
}

Button-click event-listener area

Who to talk to?

Yingzheng Cai (@Rey_cyz#1464 on discord, @Rey-666 on github)

Isaac Graham, (@The Master Craig#7285, IsaacGraham128)