com.theoworlds.builder.Tile

com.theoworlds.builder.Tile

Tile class -- floor tile main class

Version

1.0

Author

© TheoWorlds.com, 2007--2009.

Summary
com.theoworlds.builder.TileTile class -- floor tile main class
Variables
MARK_COLOR
WALKABLE_COLOR
UNWALKABLE_COLOR
_baseWalkablethis parametters is set when initializing the World unlike Tile.oWalkable it is NOT changed.
_baseActionthe same as with _baseWalkable it stores the current action
_markerMC
_gridMC
Functions
Tile
initinherited from MapObjectSettings(MapObjectSettings) TileSettings(TileSettings) and overwritten
drawTilePreviewfor debug tile registration point is in the center tileElevation -- if the tile has height, it will draw a 3D tile
Properties
griddraws a tile preview or removes it (Tile._gridMC) used for debug
grid- is the tile outline displayed (a grid)
markused for debug to mark tiles in different colors
stackable-- a flag (Boolean) that tells if other tiles can be stacked on top
stackable-- stackable value (Tile._stackable)
walkable-- returns walkable value (Tile._walkable)
walkable
baseWalkablereturns the default walkable flag (Tile._baseWalkable) that is set on initialization
baseWalkabledo not use it this method is called only by MapEditor (MapEditor)
baseActionNamedo not use it this method is called only by MapEditor (MapEditor)
baseActionNamethe default action name that is set on initialization
elevationthe height/elevation of a tile
elevation

Variables

MARK_COLOR

private static var MARK_COLOR: Number

WALKABLE_COLOR

private static var WALKABLE_COLOR: Number

UNWALKABLE_COLOR

private static var UNWALKABLE_COLOR: Number

_baseWalkable

private var _baseWalkable: Boolean

this parametters is set when initializing the World unlike Tile.oWalkable it is NOT changed.  It is used to store the walkable value set during initialization this is because oWalkable can be changed depending on Furniture.walkable. this is needed when creating dynamic landscapes (that change) Example Puddle._walkable == 0; // we can not walk on it, but if we place a wood log on it log.walkable == 1, it becomes walkable the walkable is changed in the base tile so we don’t have to loop through the whole stack of furniture to find it out World.aFloor[tileX--1][tileY--1][0] (World.aFloor) When we delete furniture, the base tile gets the walkable value of the furniture that was under the deleted one OR, if there is nothing on the top, we take the value stored in baseWalkable

_baseAction

private var _baseAction: String

the same as with _baseWalkable it stores the current action

_markerMC

private var _markerMC: MovieClip

_gridMC

private var _gridMC: MovieClip

Functions

Tile

public function Tile(target: MovieClip,
spriteMCName: String,
spriteMCZOrder: Number,
tileX: Number,
tileY: Number,
ts: TileSettings)

Parameters

targetMovieClip to wich the character object is attached to
spriteMCNamethe name of the Character._spriteMC (if it’s created)
spriteMCZOrderz--order of the Character._spriteMC (if it’s created)
tileXposition on the map -- column(:Number) (also storred in CharacterSettings)
tileYposition on the map -- row(:Number)...
ts(TileSettings)

init

private function init(ts: TileSettings):Void

inherited from MapObjectSettings(MapObjectSettings) TileSettings(TileSettings) and overwritten

drawTilePreview

public static function drawTilePreview (target: MovieClip,
borderWidth: Number,
borderColor: Number,
borderAlpha: Number,
tileColor: Number,
tileAlpha: Number,
tileElevation: Number):Void

for debug tile registration point is in the center tileElevation -- if the tile has height, it will draw a 3D tile

Parameters

targetMovieClip
borderWidthNumber
borderColorNumber
borderAlphaNumber
tileColorNumber
tileColorNumber
tileAlphaNumber
tileElevationNumber

Properties

grid

public function set grid(b: Boolean):Void

draws a tile preview or removes it (Tile._gridMC) used for debug

Parameters

b(Boolean)

grid

public function get grid():Boolean

Returns

- is the tile outline displayed (a grid)

mark

public function set mark(b: Boolean):Void

used for debug to mark tiles in different colors

Parameters

paramBoolean

stackable

public function get stackable():Boolean

Returns

-- a flag (Boolean) that tells if other tiles can be stacked on top

stackable

public function set stackable(s: Boolean):Void

Returns

-- stackable value (Tile._stackable)

walkable

public function get walkable():Boolean

Returns

-- returns walkable value (Tile._walkable)

walkable

public function set walkable(n: Boolean):Void

Parameters

n-- sets the walkable value

baseWalkable

public function get baseWalkable():Boolean

Returns

returns the default walkable flag (Tile._baseWalkable) that is set on initialization

baseWalkable

public function set baseWalkable(n: Boolean):Void

do not use it this method is called only by MapEditor (MapEditor)

baseActionName

public function set baseActionName(action: String):Void

do not use it this method is called only by MapEditor (MapEditor)

baseActionName

public function get baseActionName():String

Returns

the default action name that is set on initialization

elevation

public function get elevation():Number

Returns

the height/elevation of a tile

elevation

public function set elevation(s: Number):Void

Parameters

setsthe tile elevation
base class for all map objects classes on the map : Tile, Furniture, Character
private static var MARK_COLOR: Number
private static var WALKABLE_COLOR: Number
private static var UNWALKABLE_COLOR: Number
private var _baseWalkable: Boolean
this parametters is set when initializing the World unlike Tile.oWalkable it is NOT changed.
private var _baseAction: String
the same as with _baseWalkable it stores the current action
private var _markerMC: MovieClip
private var _gridMC: MovieClip
public function Tile(target: MovieClip,
spriteMCName: String,
spriteMCZOrder: Number,
tileX: Number,
tileY: Number,
ts: TileSettings)
private function init(ts: TileSettings):Void
inherited from MapObjectSettings(MapObjectSettings) TileSettings(TileSettings) and overwritten
This class and its inheritants is used to organize the map object parameters
TileSettings class stores the settings of a Floor tile object
public static function drawTilePreview (target: MovieClip,
borderWidth: Number,
borderColor: Number,
borderAlpha: Number,
tileColor: Number,
tileAlpha: Number,
tileElevation: Number):Void
for debug tile registration point is in the center tileElevation -- if the tile has height, it will draw a 3D tile
public function set grid(b: Boolean):Void
draws a tile preview or removes it (Tile._gridMC) used for debug
public function set mark(b: Boolean):Void
used for debug to mark tiles in different colors
public function get stackable():Boolean
-- a flag (Boolean) that tells if other tiles can be stacked on top
public function get walkable():Boolean
-- returns walkable value (Tile._walkable)
public function get baseWalkable():Boolean
returns the default walkable flag (Tile._baseWalkable) that is set on initialization
public function set baseActionName(action: String):Void
do not use it this method is called only by MapEditor (MapEditor)
public function get elevation():Number
the height/elevation of a tile
public function get walkable():Boolean
a flag (Boolean) that tells if the furniture can be stepped on by characters (Character)
CharacterSettings class stores the settings of a Character object
Close