mdh.hephaestus2
Class Terrain

java.lang.Object
  |
  +--mdh.hephaestus2.Stuff
        |
        +--mdh.hephaestus2.Terrain
All Implemented Interfaces:
Serializable

public final class Terrain
extends Stuff

Terrain types. Terrains have two "layers", each of which can have a tile. LAYER_Under is drawn as the ground, then all contents of the Grid are drawn, and then LAYER_Over is drawn above it, so you can have overhanging objects, like signs, lamp poles, arches, tree branches, etc. LAYER_Under should have no transparent pixels. LAYER_Over usually should be partially transparent, else how will you see what's in the Grid?

Author:
Copyright © 2001 by Mark Hughes <kamikaze@kuoi.asui.uidaho.edu>
See Also:
Serialized Form

Constructor Summary
Terrain(String name)
          Creates a new Terrain with the given name.
 
Method Summary
 int getOpacity()
          Returns the opacity of a Terrain, one of Global.OPA_*.
 Tile getTile(int layer)
          Returns the Tile for a given layer, one of Global.LAYER_*, or null if the tile has not been set.
 int getType()
          Returns the type constant for this object, one of Global.TYPE_*.
 boolean isType(int type)
          Returns true if this class or any of its superclasses is of 'type', one of Global.TYPE_*.
 void setOpacity(int o)
          Sets the opacity of a Terrain, one of Global.OPA_*.
 void setTile(int layer, Tile s)
          Sets the tile for a given layer (one of Global.LAYER_*).
 
Methods inherited from class mdh.hephaestus2.Stuff
destroy, getBlocking, getName, getTriggerCallback, id, setBlocking, setName, setTriggerCallback, toString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Terrain

public Terrain(String name)
        throws HephaestusException
Creates a new Terrain with the given name. This gives the Terrain a new unique ID and adds it to the database.

Parameters:
name - Human-readable name to show in descriptions. Names do not have to be unique, but should be kept fairly short so they can fit in menus. Null names are not allowed.
Method Detail

getOpacity

public final int getOpacity()
                     throws HephaestusException
Returns the opacity of a Terrain, one of Global.OPA_*.

HephaestusException

getTile

public final Tile getTile(int layer)
                   throws HephaestusException
Returns the Tile for a given layer, one of Global.LAYER_*, or null if the tile has not been set.

HephaestusException

getType

public final int getType()
Description copied from class: Stuff
Returns the type constant for this object, one of Global.TYPE_*.

Specified by:
getType in class Stuff

isType

public final boolean isType(int type)
Description copied from class: Stuff
Returns true if this class or any of its superclasses is of 'type', one of Global.TYPE_*.

Overrides:
isType in class Stuff

setOpacity

public final void setOpacity(int o)
                      throws HephaestusException
Sets the opacity of a Terrain, one of Global.OPA_*.

HephaestusException

setTile

public final void setTile(int layer,
                          Tile s)
                   throws HephaestusException
Sets the tile for a given layer (one of Global.LAYER_*).

HephaestusException