com.theoworlds.builder.Furniture

Furniture class - furniture main class

Version

1.0

Author

© TheoWorlds.com, 2007-2009.

Summary
com.theoworlds.builder.FurnitureFurniture class - furniture main class
Variables
_walkableoverwrites super._walkable = true (MapObject._walkable)
_stackableoverwrites super._stackable = true (MapObject._stackable)
_selectableflag(:Boolean) -- is the furniture clickable or not
_objectShapestores the furniture shape configuration (what tiles it covers) as a String
_registrationTilestores the registration tile -- check th documentation for more details
_occupiedTilesthe array of the tiles covered by the furniture tiles Array<Point>
_hitTestBitmapbitmap to detect the hit test.
_hitTestBitmapFirstPointparametter for BitmapData.hitTest(firstPoint:Point, firstAlphaThreshold:Number, secondObject:Object) stored for optimization purposes
Functions
Furniture
initinitialization dEditor, TileEditor, FurnitureEditor, TheoEditor, UIEditor.
onClickSpriteMCthis event is called only when selectable == true; it triggers a method in the World (World) that takes action
onRollOverSpriteMCthis event is called only when selectable == true (Furniture._selectable) it calls hitTestMode to find out if the area clicked is not transparent (empty)
onRollOutSpriteMCcalled when selectable == true (Furniture._selectable) turns off hitTestMode
hitTestModedetects if the click is made on actual non--transparent part of the furniture
setHighlightcalled when selectable == true (Furniture._selectable) highlights on un/highlights a furniture
Properties
objectShapethis string has a format “xxx xxx xxx”, where x can be 1 or 0.
registrationTilethis is just in case a new (non--default) tile was used for registration if the default registration tile is used -- undefined is returned
stackablea flag that tells if anything can be placed on the top of the furniture
stackableTODO: redundant? 
walkablea flag (Boolean) that tells if the furniture can be stepped on by characters (Character)
walkableTODO looks like it’s redundant.
elevationfurniture elevation (Number)
selectableis the furniture clickable or not (Boolean)
selectablemakes the furniture object selectable or not
occupiedTilesstores the tiles (Tile) occupied by the furniture
occupiedTilesthe tiles occupied by the furniture - [Point(tileX,tileY), [Point]]

Variables

_walkable

private var _walkable: Boolean

overwrites super._walkable = true (MapObject._walkable)

_stackable

private var _stackable: Boolean

overwrites super._stackable = true (MapObject._stackable)

_selectable

private var _selectable: Boolean

flag(:Boolean) -- is the furniture clickable or not

_objectShape

private var _objectShape: String

stores the furniture shape configuration (what tiles it covers) as a String

_registrationTile

private var _registrationTile: String

stores the registration tile -- check th documentation for more details

_occupiedTiles

private var _occupiedTiles: Array

the array of the tiles covered by the furniture tiles Array<Point>

_hitTestBitmap

private var _hitTestBitmap: BitmapData

bitmap to detect the hit test.  A standard MovieClip.hitTest would react to the transparent areas of the bitmap Is created only on _spriteMC.onRollOver Is deleted on _spriteMC.onRollOut (Furniture._spriteMC)

_hitTestBitmapFirstPoint

private var _hitTestBitmapFirstPoint: Point

parametter for BitmapData.hitTest(firstPoint:Point, firstAlphaThreshold:Number, secondObject:Object) stored for optimization purposes

Functions

Furniture

public function Furniture(target: MovieClip,
spriteMCName: String,
spriteMCZOrder: Number,
tileX: Number,
tileY: Number,
fs: FurnitureSettings)

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)...
fs(FurnitureSettings)

init

private function init(fs: FurnitureSettings):Void

initialization dEditor, TileEditor, FurnitureEditor, TheoEditor, UIEditor.  The classes will be used for debugging

Parameters

fs(FurnitureSettings)

onClickSpriteMC

private function onClickSpriteMC():Void

this event is called only when selectable == true; it triggers a method in the World (World) that takes action

onRollOverSpriteMC

private function onRollOverSpriteMC():Void

this event is called only when selectable == true (Furniture._selectable) it calls hitTestMode to find out if the area clicked is not transparent (empty)

onRollOutSpriteMC

private function onRollOutSpriteMC():Void

called when selectable == true (Furniture._selectable) turns off hitTestMode

hitTestMode

private function hitTestMode():Void

detects if the click is made on actual non--transparent part of the furniture

setHighlight

private function setHighlight(b: Boolean):Void

called when selectable == true (Furniture._selectable) highlights on un/highlights a furniture

Parameters

paramBoolean

Properties

objectShape

public function get objectShape():String

this string has a format “xxx xxx xxx”, where x can be 1 or 0.  Example: “100 100 100” the World (World) takes this string an uses it to mark the tiles

Returns

returns an array with the covered tiles

registrationTile

public function get registrationTile():String

this is just in case a new (non--default) tile was used for registration if the default registration tile is used -- undefined is returned

Returns

String for example “0,0”

stackable

public function get stackable():Boolean

a flag that tells if anything can be placed on the top of the furniture

Returns

Boolean

stackable

public function set stackable(s: Boolean):Void

TODO: redundant? may be makes sense to prohibit modifying Libabry level settings at this point?

walkable

public function get walkable():Boolean

Returns

a flag (Boolean) that tells if the furniture can be stepped on by characters (Character)

walkable

public function set walkable(n: Boolean):Void

TODO looks like it’s redundant.  Same as with _stackable TODO could be used in the future

elevation

public function get elevation():Number

Returns

furniture elevation (Number)

selectable

public function get selectable():Boolean

Returns

is the furniture clickable or not (Boolean)

selectable

public function set selectable(b: Boolean):Void

makes the furniture object selectable or not

Parameters

paramBoolean By default = false;

occupiedTiles

public function set occupiedTiles(arr: Array):Void

stores the tiles (Tile) occupied by the furniture

Parameters

arr<Point>Array - array of tiles occupied by the furniture

occupiedTiles

public function get occupiedTiles():Array

Returns

the tiles occupied by the furniture - [Point(tileX,tileY), [Point]]

base class for all map objects classes on the map : Tile, Furniture, Character
GeneratedFurniture class - This is an extended Furniture class with extra functionality used by Map Editor
private var _walkable: Boolean
overwrites super._walkable = true (MapObject._walkable)
private var _walkable: Boolean
flag(:Boolean) that tells if characters(Character) can walk on top of this object
private var _stackable: Boolean
overwrites super._stackable = true (MapObject._stackable)
private var _stackable: Boolean
stacks on top of other tiles, taking elevation in consideration
private var _selectable: Boolean
flag(:Boolean) -- is the furniture clickable or not
private var _objectShape: String
stores the furniture shape configuration (what tiles it covers) as a String
private var _registrationTile: String
stores the registration tile -- check th documentation for more details
private var _occupiedTiles: Array
the array of the tiles covered by the furniture tiles Array<Point>
private var _hitTestBitmap: BitmapData
bitmap to detect the hit test.
private var _hitTestBitmapFirstPoint: Point
parametter for BitmapData.hitTest(firstPoint:Point, firstAlphaThreshold:Number, secondObject:Object) stored for optimization purposes
public function Furniture(target: MovieClip,
spriteMCName: String,
spriteMCZOrder: Number,
tileX: Number,
tileY: Number,
fs: FurnitureSettings)
private function init(fs: FurnitureSettings):Void
initialization dEditor, TileEditor, FurnitureEditor, TheoEditor, UIEditor.
private function onClickSpriteMC():Void
this event is called only when selectable == true; it triggers a method in the World (World) that takes action
World class -- main class that builds an isometric tile--based map
private function onRollOverSpriteMC():Void
this event is called only when selectable == true (Furniture._selectable) it calls hitTestMode to find out if the area clicked is not transparent (empty)
private function onRollOutSpriteMC():Void
called when selectable == true (Furniture._selectable) turns off hitTestMode
private function hitTestMode():Void
detects if the click is made on actual non--transparent part of the furniture
private function setHighlight(b: Boolean):Void
called when selectable == true (Furniture._selectable) highlights on un/highlights a furniture
public function get objectShape():String
this string has a format “xxx xxx xxx”, where x can be 1 or 0.
public function get registrationTile():String
this is just in case a new (non--default) tile was used for registration if the default registration tile is used -- undefined is returned
public function get stackable():Boolean
a flag that tells if anything can be placed on the top of the furniture
public function get walkable():Boolean
a flag (Boolean) that tells if the furniture can be stepped on by characters (Character)
Character class -- character/avatar main class
public function get elevation():Number
furniture elevation (Number)
public function get selectable():Boolean
is the furniture clickable or not (Boolean)
public function set occupiedTiles(arr: Array):Void
stores the tiles (Tile) occupied by the furniture
Tile class -- floor tile main class
CharacterSettings class stores the settings of a Character object
FurnitureSettings class stores the settings of a Furniture object
Close