From 3c5bd7e54a45cc3e8ae6bc691d71f233883cedd7 Mon Sep 17 00:00:00 2001 From: Gaganx0 Date: Mon, 11 Sep 2023 15:51:43 +1000 Subject: [PATCH] added javadoc --- .../game/areas/terrain/TerrainFactory.java | 21 ++++++++++++++++++- .../csse3200/game/screens/GameLevelData.java | 17 ++++++++++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java b/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java index 61723330c..c65b69caa 100644 --- a/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java +++ b/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java @@ -167,7 +167,18 @@ private TiledMap createForestDemoTiles(GridPoint2 tileSize, TextureRegion grass) fillTiles(grassLayer, new GridPoint2(20, 8), grassTile); tiledMap.getLayers().add(grassLayer); - // Create lanes (invisible) + /** + * Creates lanes of invisible tiles in the TiledMap. These lanes are added as separate layers + * and are typically used for gameplay purposes. + * + * @param tiledMap The TiledMap to which the lanes should be added. + * @param tileSize The size of each tile in pixels (width and height). + * @param numberOfLanes The total number of lanes to create. + * @param mapWidth The width of the TiledMap in tiles. + * @param mapHeight The height of the TiledMap in tiles. + * @return The modified TiledMap with the added invisible lanes. + */ + int numberOfLanes = 8; int laneHeight = 1; // Height of each lane in tiles int mapWidth = 20; @@ -183,6 +194,14 @@ private TiledMap createForestDemoTiles(GridPoint2 tileSize, TextureRegion grass) return tiledMap; } + /** + * Fills a TiledMapTileLayer with invisible tiles, creating a layer of transparent tiles. + * + * @param layer The TiledMapTileLayer to fill with invisible tiles. + * @param mapSize The size of the layer in tiles (width and height). + */ + + private void fillInvisibleTiles(TiledMapTileLayer layer, GridPoint2 mapSize) { for (int x = 0; x < mapSize.x; x++) { for (int y = 0; y < mapSize.y; y++) { diff --git a/source/core/src/main/com/csse3200/game/screens/GameLevelData.java b/source/core/src/main/com/csse3200/game/screens/GameLevelData.java index b44b8e3b9..471eba7bb 100644 --- a/source/core/src/main/com/csse3200/game/screens/GameLevelData.java +++ b/source/core/src/main/com/csse3200/game/screens/GameLevelData.java @@ -1,12 +1,23 @@ package com.csse3200.game.screens; - +/** + * The {@code GameLevelData} class is responsible for managing the selected game level. + * It provides methods to get and set the selected game level. + */ public class GameLevelData { private static int selectedLevel = -1; - + /** + * Get the currently selected game level. + * + * @return The selected game level. + */ public static int getSelectedLevel() { return selectedLevel; } - + /** + * Set the selected game level. + * + * @param level The new game level to be selected. + */ public static void setSelectedLevel(int level) { selectedLevel = level; }