Weapon details - UQcsse3200/2024-studio-1 GitHub Wiki
Introduction
The Weapon details page within How To Play menu provides user with all types of weapons they can utilize within the game.
Overview
The menu can be found after clicking on "About Weapons" in main How To Play menu.
Technical Information
WeaponDisplay.java
Java class contains all necessary components for the Weapons menu.
Texts of description and picture directories are stored in the paragraphs array.
Label introLabel = new Label("Below are the available weapons in the game:", skin);
table.add(introLabel).colspan(2).pad(10).row();
String[] animalDescriptions = {
"Shotgun - 30 dmg, 5 range, 5 rounds per second, 20 rounds per magazine",
"Sword - 100 dmg, 0 range, 10 fire rate, no need to reload",
};
String[] animalImagePaths = {
"images/Weapons/Centered/Shotgun4_center.png",
"images/Weapons/Centered/Sword1_center.png",
};
Components like texts and buttons of the menu are displayed in tables, which makes everything aligned and have the same structure with every other screens. A for loop is used to add every descriptions and pictures into the table:
Table table = new Table();
for (int i = 0; i < animalDescriptions.length; i++) {
Image animalImage = new Image(new Texture(Gdx.files.internal(animalImagePaths[i])));
Label animalLabel = new Label(animalDescriptions[i], skin);
table.add(animalImage).size(100, 100).pad(10);
table.add(animalLabel).pad(10).left().row();
}
Label bottomLabel = new Label("For melee weapons, press Space to use - Use arrow keys for ranged weapons.", skin);
table.add(bottomLabel).colspan(2).pad(10).row();
return table;