Tile

The tile class represents a single tile and all the properties of that tile. Tiles are added to maps via the TileInstance class. Each tile stores their graphic tile type list, name, description and the tile set which this tile is apart of.
Return to Index
new ( string name )
new ( string name , string full_name )
__gc ( )
__eq ( am.tile rhs ) -> ( boolean )
name ( ) -> ( string )
name ( string name , boolean check_for_existing = false ) -> ( boolean )
full_name ( ) -> ( string )
full_name ( string full_name ) -> ( am.tile )
description ( ) -> ( string )
description ( string description ) -> ( am.tile )
tile_set ( ) -> ( TileSet )
tile_set ( TileSet set , boolean check_for_existing = false ) -> ( boolean )
asset ( ) -> ( am.asset )
asset ( string asset_name ) -> ( am.tile )
asset ( am.asset asset ) -> ( am.tile )
add_tile_type ( am.tile_type... tile_type ) -> ( am.tile )
add_tile_type ( string... tile_type_name ) -> ( am.tile )
remove_tile_type ( am.tile_type... tile_type ) -> ( am.tile )
remove_tile_type ( string... tile_type_name ) -> ( am.tile )
remove_all_tile_types ( ) -> ( am.tile )
has_tile_type ( am.tile_type tile_type ) -> ( boolean )
has_tile_type ( string tile_type_name ) -> ( boolean )
tile_types ( ) -> ( Array )
precedence ( ) -> ( integer )
precedence ( integer precedence ) -> ( am.tile )
add_transitional ( am.asset asset , am.tile overlap_tile = nil ) -> ( am.tile )
add_transitional ( string asset_name , am.tile overlap_tile = nil ) -> ( am.tile )
remove_transitional ( am.asset asset , am.tile overlap_tile = nil ) -> ( am.tile )
remove_transitional ( string asset_name , am.tile overlap_tile = nil ) -> ( am.tile )
has_transitional ( am.asset asset , am.tile overlap_tile = nil ) -> ( boolean )
has_transitional ( string asset_name , am.tile overlap_tile = nil ) -> ( boolean )
has_transitional ( am.tile overlap_tile = nil ) -> ( boolean )
transitional ( am.tile overlap_tile = nil ) -> ( table )
all_transitional ( ) -> ( table )
new ( string name )
Creates a new tile object with the given name, the name need only be unique within its tile set. Until a full name is specified, the tile full name is "No full name"
Parameters:
string name : The name of the tile.
new ( string name , string full_name )
Creates a new tile object with the given name and full name, the name need only be unique within its tile set. Full name differs in that it is the name that is presented to the user.
Parameters:
string name : The name of the tile.
string full_name : The full name of the tile.
__gc ( )
Release the reference count on this tile.
__eq ( am.tile rhs ) -> ( boolean )
Compares this tile against another tile object.
Parameters:
am.tile rhs : The other tile to compare with.
Returns:
boolean : True if they are the same tile object.
name ( ) -> ( string )
Returns the tile name.
Returns:
string : The name of the tile.
name ( string name , boolean check_for_existing = false ) -> ( boolean )
Sets the name of the tile. If there already exists a tile with the same name, it will be overridden by this tile if the 'check_for_existing' argument is not true.
Parameters:
string name : The new name for this tile.
boolean check_for_existing = false : When true the name will be not changed if there is already a tile with the same name in the tile's tile set.
Returns:
boolean : True if the tile's name was changed.
full_name ( ) -> ( string )
Returns the full name of this tile, this is used to display the tile's name to the user.
Returns:
string : The tiles full name.
full_name ( string full_name ) -> ( am.tile )
Sets the tile's full name, this is used to display the tile's name to the user.
Parameters:
string full_name : The tile's new full name.
Returns:
am.tile : This
description ( ) -> ( string )
Returns the description for this tile.
Returns:
string : The tiles description.
description ( string description ) -> ( am.tile )
Sets the tile's description.
Parameters:
string description : The tile's description.
Returns:
am.tile : This
tile_set ( ) -> ( TileSet )
Returns the tile set that this tile is apart of, nil will be return if it is not part of a tile set.
Returns:
TileSet : The tile's tile set, or nil if it does not have one.
tile_set ( TileSet set , boolean check_for_existing = false ) -> ( boolean )
Sets and adds the tile to the given tile set. Any tile with the same name in the tile set will be overridden by this tile. Unless the 'check_for_existing' argument is set to true, then if the tileset already has a tile with the same name then tile set is not changed.
Parameters:
TileSet set : The tile set to add to, can be nil.
boolean check_for_existing = false : When true the tile set will not be changed if it already has a tile with the same name.
Returns:
boolean : True if the tile set was changed.
asset ( ) -> ( am.asset )
Returns the graphical asset used by this tile. Can be nil.
Returns:
am.asset : The asset.
asset ( string asset_name ) -> ( am.tile )
Sets the graphical asset of this tile by asset name.
Parameters:
string asset_name : The name of the asset to use.
Returns:
am.tile : This
asset ( am.asset asset ) -> ( am.tile )
Sets the graphical asset.
Parameters:
am.asset asset : The asset to use.
Returns:
am.tile : This
add_tile_type ( am.tile_type... tile_type ) -> ( am.tile )
Adds a tile type to the list of tile types. If a type is already in the list, it will be ignored.
Parameters:
am.tile_type... tile_type : The tile type to add to the list.
Returns:
am.tile : This
add_tile_type ( string... tile_type_name ) -> ( am.tile )
Adds a tile type to the list of tile types. If a type is already in the list, it will be ignored.
Parameters:
string... tile_type_name : The name of the tile type to add to the list.
Returns:
am.tile : This
remove_tile_type ( am.tile_type... tile_type ) -> ( am.tile )
Removes a tile type from the list of tile types. If a type is not in the list, it will be ignored.
Parameters:
am.tile_type... tile_type : The tile type to remove from the list.
Returns:
am.tile : This
remove_tile_type ( string... tile_type_name ) -> ( am.tile )
Removes a tile type from the list of tile types. If a type is not in the list, it will be ignored.
Parameters:
string... tile_type_name : The name of the tile type to remove from the list.
Returns:
am.tile : This
remove_all_tile_types ( ) -> ( am.tile )
Removes all tile types from this tiles list of tile types.
Returns:
am.tile : This
has_tile_type ( am.tile_type tile_type ) -> ( boolean )
Returns true if the given tile type is in the list of tile types.
Parameters:
am.tile_type tile_type : The tile type to check for.
Returns:
boolean : True if the given tile type is in the list.
has_tile_type ( string tile_type_name ) -> ( boolean )
Returns true if the given tile type is in the list of tile types.
Parameters:
string tile_type_name : The name of tile type to check for.
Returns:
boolean : True if the given tile type is in the list.
tile_types ( ) -> ( Array )
Returns an array of all the tile types in this tiles list of tile tpyes.
 tile = am.tile.new("swamp")
 land = am.tile_type.new("land")
 water = am.tile_type.new("water")
 tile:add_tile_type(land)
 tile:add_tile_type(water)
 
 types = tile:tile_types()
 am_log("Type 1: " .. types[1]:name()") -- Outputs "Type 1: land"
 am_log("Type 2: " .. types[2]:name()") -- Outputs "Type 2: wayer"
Returns:
Array : The array of all the tile types on this tile.
precedence ( ) -> ( integer )
Returns the precedence of the tile. Precedence determines which tiles overlaps which tile. Tiles with a higher precedence will overlap tiles with lower precedence. If two tiles have the same precedence then it is based on which tile has the lower lexigraphical value.
Returns:
integer : The precedence.
precedence ( integer precedence ) -> ( am.tile )
Sets the precedence of the tile.
Parameters:
integer precedence : The precedence to set to.
Returns:
am.tile : This
add_transitional ( am.asset asset , am.tile overlap_tile = nil ) -> ( am.tile )
Adds a transitional tile graphic. This tile graphic should have 32 texture windows to represent the different edges and corner types. Only texture level animation is supported, so the asset must have multiple textures in order to be animated. The optional overlap_tile defines if this transitional graphic should only be used when overlapping the specific overlap_tile. An overlap tile of nil indicates default overlap.
Parameters:
am.asset asset : The asset to use for transitional overlapping.
am.tile overlap_tile = nil : When not nil, this specifies that the asset is only to be used when overlapping this tile. Otherwise it is used for all overlappings.
Returns:
am.tile : This
add_transitional ( string asset_name , am.tile overlap_tile = nil ) -> ( am.tile )
Adds a transitional tile graphic. This tile graphic should have 32 texture windows to represent the different edges and corner types. Only texture level animation is supported, so the asset must have multiple textures in order to be animated. The optional overlap_tile defines if this transitional graphic should only be used when overlapping the specific overlap_tile. An overlap tile of nil indicates default overlap.
Parameters:
string asset_name : The name of the asset to use for transitional overlapping.
am.tile overlap_tile = nil : When not nil, this specifies that the asset is only to be used when overlapping this tile. Otherwise it is used for all overlappings.
Returns:
am.tile : This
remove_transitional ( am.asset asset , am.tile overlap_tile = nil ) -> ( am.tile )
Removes a transitional tile graphic. The optional overlap_tile defines if this transitional graphic should only be used when overlapping the specific overlap_tile. An overlap tile of nil indicates default overlap.
Parameters:
am.asset asset : The asset to remove form transitional overlapping.
am.tile overlap_tile = nil : When not nil, defines the specific tile to remove the asset from. Otherwise it is removed from all overlappings.
Returns:
am.tile : This
remove_transitional ( string asset_name , am.tile overlap_tile = nil ) -> ( am.tile )
Removes a transitional tile graphic. The optional overlap_tile defines if this transitional graphic should only be used when overlapping the specific overlap_tile. An overlap tile of nil indicates default overlap.
Parameters:
string asset_name : The name of the asset to remove form transitional overlapping.
am.tile overlap_tile = nil : When not nil, defines the specific tile to remove the asset from. Otherwise it is removed from all overlappings.
Returns:
am.tile : This
has_transitional ( am.asset asset , am.tile overlap_tile = nil ) -> ( boolean )
Returns true if the given asset is being used to overlap the give overlap_tile. If overlap_tile is nil then it is checked against the default list of overlapping assets.
Parameters:
am.asset asset : The asset to check for.
am.tile overlap_tile = nil : The overlap tile the asset might be used for.
Returns:
boolean : True if found.
has_transitional ( string asset_name , am.tile overlap_tile = nil ) -> ( boolean )
Returns true if the given asset name is being used to overlap the give overlap_tile. If overlap_tile is nil then it is checked against the default list of overlapping assets.
Parameters:
string asset_name : The name of the asset to check for.
am.tile overlap_tile = nil : The overlap tile the asset might be used for.
Returns:
boolean : True if found.
has_transitional ( am.tile overlap_tile = nil ) -> ( boolean )
Returns true if any assets are in use for the overlapping the given tile. If overlap_tile is nil then returns true if any assets are used to overlap tiles by default.
Parameters:
am.tile overlap_tile = nil : The overlap tile to check.
Returns:
boolean : True if found.
transitional ( am.tile overlap_tile = nil ) -> ( table )
Returns a table array of all the assets that can be used for transitional overlap when overlapping the given tile. If no tile to check against if given then the default list is returned.
Parameters:
am.tile overlap_tile = nil : The tile to get the list of assets that will be used to overlap it.
Returns:
table : An array of all the assets.
all_transitional ( ) -> ( table )
Returns a table that contains all the transitional assets that will be used. Each key value is the name of the tile and each value is a table array that contains all the assets. The key for the default list is "_default_".
Returns:
table : A table that defines all the transitional assets.