Package model.levels

Interface LevelImportMethods


public interface LevelImportMethods
Provides methods to import level data from images.

The LevelImportMethods interface includes static methods to read level data, enemy data, wind direction data, and bubble generator data from images. These methods are used to initialize the game levels.

  • Method Details

    • GetAllLevels

      static BufferedImage[] GetAllLevels()
      Returns an array of BufferedImages representing all levels.

      This method reads all level map images from the `/levelMaps` directory, sorts them by file name, and loads them into an array of BufferedImages.

      Returns:
      an array of BufferedImages representing all levels
    • GetLevelTilesData

      static int[][] GetLevelTilesData(BufferedImage img)
      Returns the level tiles data from the given image.

      This method reads the level map from the provided image, where each pixel represents a tile. The red component of each pixel determines the tile type.

      • 0: Empty tile
      • 1: Level 1 tile type
      • 2: Level 2 tile type
      • ...
      Parameters:
      img - the image representing the level
      Returns:
      a 2D array of integers representing the level tiles data
    • GetEnemies

      static ArrayList<EnemyModel> GetEnemies(BufferedImage img)
      Returns a list of enemies from the given level image.

      This method reads the enemy data from the provided image, where each pixel represents a tile. The green component of each pixel determines the type and direction of the enemy.

      • 0: No enemy
      • 1: Zen-Chan facing left
      • 2: Zen-Chan facing right
      • 3: Maita facing left
      • 4: Maita facing right
      Parameters:
      img - the image representing the level
      Returns:
      a list of EnemyModel objects representing the enemies
    • GetWindsDirectionsData

      static Constants.Direction[][] GetWindsDirectionsData(BufferedImage img)
      Returns the wind directions data from the given image.

      This method reads the wind currents data from the provided image, where each pixel represents a tile. The blue component of each pixel determines the wind direction.

      • 0 or 100: No wind (don't move)
      • 1 or 101: Wind to the left
      • 2 or 102: Wind to the right
      • 3 or 103: Wind up
      • 4 or 104: Wind down
      Parameters:
      img - the image representing the level
      Returns:
      a 2D array of Direction enums representing the wind directions data
    • GetBubbleGenerator

      static BubbleGenerator GetBubbleGenerator(BufferedImage img)
      Returns the bubble generator data from the given image.

      This method reads the bubble generator data from the top left corner pixel of the provided image. The green component of the pixel determines the type and position of the bubble generator.

      • 101: Water bubble generator on top of the level
      • 102: Water bubble generator on the bottom of the level
      • 103: Lightning bubble generator on top of the level
      • 104: Lightning bubble generator on the bottom of the level
      • Any other value: No bubble generators
      Parameters:
      img - the image representing the level
      Returns:
      a BubbleGenerator object representing the bubble generator data