public class LevelData
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LevelData.Point
Special point class that is used to get neighbors and handle
other useful functions
|
| Constructor and Description |
|---|
LevelData(int width,
int length)
construct data for a level
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkConnectivity(int x,
int y)
check if this wall will case the world not to be connected any more
|
boolean |
checkConnectivity(int x1,
int y1,
int x2,
int y2)
check if the two positions are connected
|
boolean |
checkInLevel(int x,
int y)
check if the point is inside the borders of the level
|
java.lang.String |
get(int x,
int y)
get the sprite at a certain position
|
java.util.ArrayList<LevelData.Point> |
getAllFreeSpots()
get all empty locations in the level
|
int |
getHeight()
get the height of the level
|
java.lang.String |
getLevel()
get the 2D level in form of string
|
java.util.HashMap<java.lang.Character,java.util.ArrayList<java.lang.String>> |
getLevelMapping()
get the level mapping hashmap
|
int |
getWidth()
get the width of the level
|
void |
set(int x,
int y,
java.lang.String stype)
set a position in the map to a certain type
|
public LevelData(int width,
int length)
width - level widthlength - level heightpublic java.lang.String getLevel()
public void set(int x,
int y,
java.lang.String stype)
x - x position on the mapy - y position on the mapstype - the sprite to addedpublic java.lang.String get(int x,
int y)
x - x position on the mapy - y position on the mappublic int getWidth()
public int getHeight()
public boolean checkConnectivity(int x1,
int y1,
int x2,
int y2)
x1 - x position of the first pointy1 - y position of the first pointx2 - x position of the second pointy2 - y position of the second pointpublic boolean checkConnectivity(int x,
int y)
x - x position for the pointy - y position for the pointpublic boolean checkInLevel(int x,
int y)
x - x position for the pointy - y position for the pointpublic java.util.ArrayList<LevelData.Point> getAllFreeSpots()
public java.util.HashMap<java.lang.Character,java.util.ArrayList<java.lang.String>> getLevelMapping()