Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.meowers.cide.data
Class Map  view Map download Map.java

java.lang.Object
  extended byorg.meowers.cide.data.GameObject
      extended byorg.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%

Field Summary
private  java.util.ArrayList cells
           
private  int height
           
private  java.lang.String name
           
private  int width
           
 
Fields inherited from class org.meowers.cide.data.GameObject
dirty, GAME_DATA, MAP, MAX_TYPE, TILE, TILE_SET, type
 
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.
 
Methods inherited from class org.meowers.cide.data.GameObject
getName, getType, isDirty, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cells

private java.util.ArrayList cells

width

private int width

height

private int height

name

private java.lang.String name
Constructor Detail

Map

public Map()
Creates a new empty Map which has one cell.

Method Detail

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.