org.deken.game.map
Class FreeStyleMap

java.lang.Object
  extended by org.deken.game.map.GameMap
      extended by org.deken.game.map.FreeStyleMap
All Implemented Interfaces:
Updateable

public class FreeStyleMap
extends GameMap

Title: FreeStyleMap

Description: A FreeStyleMap uses no tiles, but is a simple free form area for the game.

Copyright: Copyright (c) Dec 12, 2010

Version:
1.0
Author:
Gary Deken

Nested Class Summary
 
Nested classes/interfaces inherited from class org.deken.game.map.GameMap
GameMap.QUEUE
 
Field Summary
 
Fields inherited from class org.deken.game.map.GameMap
background, collisionMap, components, layout, mapRenderer, mapSize, updateables
 
Constructor Summary
FreeStyleMap(int width, int height)
          Creates a FreeStyleMap given the height and width, that has no specific grid size.
FreeStyleMap(MapSize mapSize)
          Creates a FreeStyleMap based on the MapSize.
 
Method Summary
 void addSection(Section section, GameLocation gameLocation)
          Add a Section to the specified location.
 void addSprite(Sprite sprite, GameLocation gameLocation)
          Add a sprite to the specified location.
 Sprite addSpriteCopy(Sprite sprite, GameLocation gameLocation)
          Add a copy of the sprite to the specified location.
 Decor addTile(Decor decor, GameLocation gameLocation)
          This simply calls addSprite.
 Decor addTile(Decor decor, GameLocation gameLocation, boolean placeHolder, boolean nonTileCollision)
          This simply calls addSprite
 Actor getPlayer()
          Gets the player Sprite.
 java.util.Collection<Sprite> getSprites()
          Returns the list of all moving sprites.
 MapElement getTile(int x, int y, int z)
          Returns the MapElement at the map grid location.
 boolean removeSprite(Sprite sprite)
           
 Decor removeTile(GameLocation gameLocation)
           
 void setCollisionMap(CollisionMap collisionMap)
           
 void setKeepOnMap(boolean keepOnMap)
           
 void setPlayer(Actor player, GameLocation gameLocation)
          Sets the player Sprite.
 void update(long elapseTime)
          Update the elements in the GameMap.
 
Methods inherited from class org.deken.game.map.GameMap
addComponents, addUpdateable, clearQueueComponents, draw, getActions, getBackground, getComponentByName, getComponents, getLayout, getMapSize, getName, removeComponent, setBackground, setLayout, setMapRenderer, setMapSize, setName, setScreenSize, setupPlayer, updateQueueComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreeStyleMap

public FreeStyleMap(int width,
                    int height)
Creates a FreeStyleMap given the height and width, that has no specific grid size. The grid size is defaulted to 1.

Parameters:
width -
height -

FreeStyleMap

public FreeStyleMap(MapSize mapSize)
Creates a FreeStyleMap based on the MapSize. If the MapSize does not have a grid size it is defaulted to 1.

Parameters:
mapSize -
Method Detail

addSection

public void addSection(Section section,
                       GameLocation gameLocation)
Description copied from class: GameMap
Add a Section to the specified location. This method should be synchronized.

Specified by:
addSection in class GameMap
Parameters:
section - Section
gameLocation - GameLocation

addSprite

public void addSprite(Sprite sprite,
                      GameLocation gameLocation)
Description copied from class: GameMap
Add a sprite to the specified location. This method should be synchronized.

Specified by:
addSprite in class GameMap
Parameters:
sprite -
gameLocation -

addSpriteCopy

public Sprite addSpriteCopy(Sprite sprite,
                            GameLocation gameLocation)
Description copied from class: GameMap
Add a copy of the sprite to the specified location. This method should be synchronized.

Specified by:
addSpriteCopy in class GameMap
Parameters:
sprite -
gameLocation -
Returns:
Sprite Returns the copied Sprite

addTile

public Decor addTile(Decor decor,
                     GameLocation gameLocation)
This simply calls addSprite.

Specified by:
addTile in class GameMap
Parameters:
decor -
gameLocation -
Returns:
Decor Returns the copied Decor

addTile

public Decor addTile(Decor decor,
                     GameLocation gameLocation,
                     boolean placeHolder,
                     boolean nonTileCollision)
This simply calls addSprite

Specified by:
addTile in class GameMap
Parameters:
decor -
gameLocation -
placeHolder -
nonTileCollision -
Returns:
Decor Returns the copied Decor

getPlayer

public Actor getPlayer()
Description copied from class: GameMap
Gets the player Sprite.

Specified by:
getPlayer in class GameMap
Returns:
Actor

getSprites

public java.util.Collection<Sprite> getSprites()
Description copied from class: GameMap
Returns the list of all moving sprites.

Specified by:
getSprites in class GameMap
Returns:
Collection of sprites

getTile

public MapElement getTile(int x,
                          int y,
                          int z)
Description copied from class: GameMap
Returns the MapElement at the map grid location.

Specified by:
getTile in class GameMap
Parameters:
x - int
y - int
z - int
Returns:
MapElement

removeSprite

public boolean removeSprite(Sprite sprite)
Specified by:
removeSprite in class GameMap
Returns:
sprite removed.

removeTile

public Decor removeTile(GameLocation gameLocation)
Specified by:
removeTile in class GameMap
Returns:
Decor

setCollisionMap

public void setCollisionMap(CollisionMap collisionMap)
Specified by:
setCollisionMap in class GameMap
Parameters:
collisionMap - CollisionMap

setKeepOnMap

public void setKeepOnMap(boolean keepOnMap)

setPlayer

public void setPlayer(Actor player,
                      GameLocation gameLocation)
Description copied from class: GameMap
Sets the player Sprite. This method should be synchronized.

Specified by:
setPlayer in class GameMap
Parameters:
player - Actor
gameLocation - GameLocation

update

public void update(long elapseTime)
Description copied from class: GameMap
Update the elements in the GameMap.

Specified by:
update in interface Updateable
Overrides:
update in class GameMap
Parameters:
elapseTime - long