java.lang.Object
org.meowers.cide.data.GameObject
org.meowers.cide.data.Map
- All Implemented Interfaces:
- java.io.Serializable
- public class Map
- extends GameObject
Represents and entire map, made up of tiles.
- Version:
- %I%, %G%
|
Constructor Summary |
Map()
Creates a new empty Map which has one cell. |
|
Method Summary |
void |
addHeight(int size)
Increase or decrease the height of the Map. |
void |
addWidth(int size)
Increases or decrease the width of the Map. |
int |
getHeight()
Returns the height of the map. |
Tile |
getTileAt(int x,
int y)
Gets the Tile at the specified position. |
int |
getWidth()
Returns the width of the map. |
void |
resize(int width,
int height)
Resize the map to a new size. |
void |
setTileAt(int x,
int y,
Tile t)
Set the Tile at the map cell specified to the specified
Tile. |
cells
private java.util.ArrayList cells
width
private int width
height
private int height
name
private java.lang.String name
Map
public Map()
- Creates a new empty Map which has one cell.
getWidth
public int getWidth()
- Returns the width of the map.
getHeight
public int getHeight()
- Returns the height of the map.
resize
public void resize(int width,
int height)
- Resize the map to a new size. If the map is being enlarged, fill those
cells with empty tiles. If the map is being shrunk, just drop the
affected cells.
NOTE: Does not support shrinking yet. And is destructive right now.
addWidth
public void addWidth(int size)
- Increases or decrease the width of the
Map. The new cells
are created with empty Tile contents.
addHeight
public void addHeight(int size)
- Increase or decrease the height of the
Map. If new cells
are created, they contain new, emtpy Tile objects.
setTileAt
public void setTileAt(int x,
int y,
Tile t)
- Set the
Tile at the map cell specified to the specified
Tile.
getTileAt
public Tile getTileAt(int x,
int y)
- Gets the
Tile at the specified position.