Skip to content

AnimalSelectionDisplay for Land, Water, and Air

Shaivika Anand edited this page Sep 11, 2024 · 4 revisions

The AnimalSelectionDisplay class represents the user interface for selecting land animals in the game. This class extends the AnimalSelectionDisplay and provides specific information about land/air/water animals, such as the background image and the animals available for selection.

Class Declaration

public class LandAnimalSelectionDisplay extends AnimalSelectionDisplay

Constructor

AnimalSelectionDisplay(Stage stage, Skin skin)

This constructor initializes the land/air/water animal selection screen using the provided stage and skin.

Parameters:

stage: The stage where the screen will be displayed

skin : The UI skin for styling the components

Methods

protected String getBackgroundImagePath()

Overrides the getBackgroundImagePath() method from the AnimalSelectionDisplay class to return the path of the background image specific to the land animal selection screen.

Returns:

String - the file path for the land/water/air animal background image which returns the provided Background Image

protected String[] getAnimalImagePaths()

Overrides the getAnimalImagePaths() method to provide the image paths for the land animals available for selection.

Returns:

String[] - an array of file paths for land animal images. The current land/air/water animals

Inherited Methods from AnimalSelectionDisplay

This class inherits the common functionality for selection screens from AnimalSelectionDisplay. This includes rendering, handling user inputs, and displaying animal options.

Usage Example

To create an instance of AnimalSelectionDisplay, one can do the following:

Skin skin = new Skin();
LandAnimalSelectionDisplay landSelection = new LandAnimalSelectionDisplay(stage, skin); 

This will initialize the land animal selection screen with the provided stage and skin.

Clone this wiki locally