Skip to content

Commit

Permalink
Images and description for mob bosses
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaganx0 committed Oct 9, 2023
1 parent 030a2ea commit fc9f6dc
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Stage;
Expand Down Expand Up @@ -75,6 +76,55 @@ public void clicked(com.badlogic.gdx.scenes.scene2d.InputEvent event, float x, f
table2.pad(20); // Add padding to the middle-right corner
table2.add(buttonTable1).row(); // Add button table and move to the next row
stage.addActor(table2);

Table imageTextTable = new Table();
imageTextTable.setFillParent(true);
imageTextTable.center();

float leftPadding = 30f;
imageTextTable.padLeft(leftPadding);

// Create an array of image file names
String[] imageFileNames = {
"images/HelpScreen/Patrickbosshelp.png",
"images/HelpScreen/IceBosshelp.png",
"images/HelpScreen/Demonbosshelp.png"
};

// Create an array of text descriptions
String[] textDescriptions = {
"Patrick is able to teleport to the closest entity and do damage as well as shoot projectiles and melee attack. Once Patrick hits half health, it will shoot 5 projectiles of random effect.",
"The Ice Baby is able to spawn water mobs and do AOE damage.",
"Demon boss is able to shoot burn projectiles and do AOE damage. Demon boss is also able to regenerate health once it hits half health.",
};

// Add images and text to the table
for (int i = 0; i < imageFileNames.length; i++) {
// Create an image from the file
Image imager = new Image(new Texture(imageFileNames[i]));
float imageSize = 200f;
imager.setSize(imageSize, imageSize);

// Create a label for text description
Label.LabelStyle labelStyle = new Label.LabelStyle();
BitmapFont customFont = new BitmapFont(Gdx.files.internal("images/ui/buttons/dot_gothic_16.fnt")); // Replace "your-font.fnt" with your font file path
customFont.getData().setScale(1.2f); // Adjust the scale factor to change the text size
labelStyle.font = customFont;

Label label = new Label(textDescriptions[i], labelStyle);
label.setWrap(true);

// Add the image and label to the table in two columns
Cell<Image> imageCell = imageTextTable.add(imager).expandX().pad(10); // Add spacing around the image
Cell<Label> labelCell = imageTextTable.add(label).expandX().pad(5);

float maxCellWidth = 1100f; // Adjust the width as needed
labelCell.width(maxCellWidth);

labelCell.left();
// Move to the next row
imageTextTable.row();
}
}
@Override
public void show() {
Expand Down

0 comments on commit fc9f6dc

Please sign in to comment.