Package org.collebol.game.world
Class Chunk
java.lang.Object
org.collebol.game.world.Chunk
The Chunk class represents a segment of the game world, containing tiles ad entities.
It is used to manage and organize game objects within a specific area, defined by its size and position.
Each chunk holds a collection of tiles and entities, allowing for efficient rendering and updating the game world.
Usage:
MyChunk chunk = new MyChunk(chunkSize, chunkX, chunkY);
chunk.addTile(tile);
- Since:
- 1.0-dev
- Author:
- ColleBol - contact@collebol.org
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntity(GameObject entity) voidaddTile(GameObject tile) Adds a tile to the chunk.intgetTiles()intgetX()intgetY()voidsetChunkSize(int chunkSize) voidsetX(int x) voidsetY(int y)
-
Constructor Details
-
Chunk
public Chunk(int chunkSize, int x, int y) Chunk constructor.- Parameters:
chunkSize- the size of the chunk. Example: 16 (16x16)x- the x-coordinate of the chunk.y- the y-coordinate of the chunk.
-
-
Method Details
-
getChunkSize
public int getChunkSize() -
setChunkSize
public void setChunkSize(int chunkSize) -
getX
public int getX() -
setX
public void setX(int x) -
getY
public int getY() -
setY
public void setY(int y) -
getTiles
- Returns:
- a list of all tiles in the Chunk.
-
getTilesAsMap
- Returns:
- a map of tiles grouped by their texture id.
-
getEntities
-