How To Play Menu - UQcsse3200/2024-studio-1 GitHub Wiki

Introduction

How To Play provides details Beast Breakout, covering essential aspects such as weapons, items, animals, gameplay mechanics, and key bindings. This information equips players with a better understanding of how to play the game.

Overview

The How To Play button can be found in the main menu, which leads to the How To Play page with instructions for the game (as in attached picture). In the next sprints, this page will be improved with icons and images of animals, items or weapons along with more detailed description.

Screenshot 2024-08-27 at 21 32 04

Technical Information

HowToPlayMenuDisplay.java Java class contains all necessary components for the How To Play menu.

Texts of instruction are stored in the paragraphs array.

String[][] paragraphs = {{
                "Text goes here... "
                        + "...",
                "..."
            }, {
                "... "
            }, {
                "..."
            }
        };

Components of the menu are displayed in tables, which makes everything aligned and have the same structure with every other screens:

Table table = new Table();
        table.add(instruction).left().padRight(10f);
        table.row().padTop(40f);

        for (String[] paragraph : paragraphs) {
            for (int i = 0; i < paragraph.length; i++) {
                String line = paragraph[i];
                Label label = new Label(line, skin);
                table.add(label).left().expandX();

                // Different padding for end of paragraph
                boolean lastLine = (i + 1 == paragraph.length);
                table.row().padTop(lastLine ? 40f : 10f);
            }
        }
        table.add(animalBtn).left().expandX();
        table.row().padTop(10f);
        table.add(weaponBtn).left().expandX();
return table;