com.theoworlds.builder.Furniture |
Furniture class - furniture main class
1.0
© TheoWorlds.com, 2007-2009.
| com. | Furniture class - furniture main class |
| Variables | |
| _walkable | overwrites super._walkable = true (MapObject._walkable) |
| _stackable | overwrites super._stackable = true (MapObject._stackable) |
| _selectable | flag(:Boolean) -- is the furniture clickable or not |
| _objectShape | stores the furniture shape configuration (what tiles it covers) as a String |
| _registrationTile | stores the registration tile -- check th documentation for more details |
| _occupiedTiles | the array of the tiles covered by the furniture tiles Array<Point> |
| _hitTestBitmap | bitmap to detect the hit test. |
| _hitTestBitmapFirstPoint | parametter for BitmapData.hitTest(firstPoint:Point, firstAlphaThreshold:Number, secondObject:Object) stored for optimization purposes |
| Functions | |
| Furniture | |
| init | initialization dEditor, TileEditor, FurnitureEditor, TheoEditor, UIEditor. |
| onClickSpriteMC | this event is called only when selectable == true; it triggers a method in the World (World) that takes action |
| onRollOverSpriteMC | 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 | called when selectable == true (Furniture._selectable) turns off hitTestMode |
| hitTestMode | detects if the click is made on actual non--transparent part of the furniture |
| setHighlight | called when selectable == true (Furniture._selectable) highlights on un/highlights a furniture |
| Properties | |
| objectShape | this string has a format “xxx xxx xxx”, where x can be 1 or 0. |
| registrationTile | this is just in case a new (non--default) tile was used for registration if the default registration tile is used -- undefined is returned |
| stackable | a flag that tells if anything can be placed on the top of the furniture |
| stackable | TODO: redundant? |
| walkable | a flag (Boolean) that tells if the furniture can be stepped on by characters (Character) |
| walkable | TODO looks like it’s redundant. |
| elevation | furniture elevation (Number) |
| selectable | is the furniture clickable or not (Boolean) |
| selectable | makes the furniture object selectable or not |
| occupiedTiles | stores the tiles (Tile) occupied by the furniture |
| occupiedTiles | the tiles occupied by the furniture - [Point(tileX,tileY), [Point]] |
private var _walkable: Boolean
overwrites super._walkable = true (MapObject._walkable)
private var _stackable: Boolean
overwrites super._stackable = true (MapObject._stackable)
public function Furniture( target: MovieClip, spriteMCName: String, spriteMCZOrder: Number, tileX: Number, tileY: Number, fs: FurnitureSettings )
| target | MovieClip to wich the character object is attached to |
| spriteMCName | the name of the Character._spriteMC (if it’s created) |
| spriteMCZOrder | z--order of the Character._spriteMC (if it’s created) |
| tileX | position on the map -- column(:Number) (also storred in CharacterSettings) |
| tileY | position on the map -- row(:Number)... |
| fs | (FurnitureSettings) |
private function init( fs: FurnitureSettings ):Void
initialization dEditor, TileEditor, FurnitureEditor, TheoEditor, UIEditor. The classes will be used for debugging
| fs | (FurnitureSettings) |
private function onClickSpriteMC():Void
this event is called only when selectable == true; it triggers a method in the World (World) that takes action
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 setHighlight( b: Boolean ):Void
called when selectable == true (Furniture._selectable) highlights on un/highlights a furniture
| param | Boolean |
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 an array with the covered tiles
public function get walkable():Boolean
a flag (Boolean) that tells if the furniture can be stepped on by characters (Character)
public function set occupiedTiles( arr: Array ):Void
stores the tiles (Tile) occupied by the furniture
| arr | <Point>Array - array of tiles occupied by the furniture |
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 _walkable: Boolean
overwrites super._stackable = true (MapObject._stackable)
private var _stackable: Boolean
stacks on top of other tiles, taking elevation in consideration
private var _stackable: Boolean
flag(:Boolean) -- is the furniture clickable or not
private var _selectable: Boolean
stores the furniture shape configuration (what tiles it covers) as a String
private var _objectShape: String
stores the registration tile -- check th documentation for more details
private var _registrationTile: String
the array of the tiles covered by the furniture tiles Array<Point>
private var _occupiedTiles: Array
bitmap to detect the hit test.
private var _hitTestBitmap: BitmapData
parametter for BitmapData.hitTest(firstPoint:Point, firstAlphaThreshold:Number, secondObject:Object) stored for optimization purposes
private var _hitTestBitmapFirstPoint: Point
public function Furniture( target: MovieClip, spriteMCName: String, spriteMCZOrder: Number, tileX: Number, tileY: Number, fs: FurnitureSettings )
initialization dEditor, TileEditor, FurnitureEditor, TheoEditor, UIEditor.
private function init( fs: FurnitureSettings ):Void
this event is called only when selectable == true; it triggers a method in the World (World) that takes action
private function onClickSpriteMC():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 onRollOverSpriteMC():Void
called when selectable == true (Furniture._selectable) turns off hitTestMode
private function onRollOutSpriteMC():Void
detects if the click is made on actual non--transparent part of the furniture
private function hitTestMode():Void
called when selectable == true (Furniture._selectable) highlights on un/highlights a furniture
private function setHighlight( b: Boolean ):Void
this string has a format “xxx xxx xxx”, where x can be 1 or 0.
public function get objectShape():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 registrationTile():String
a flag that tells if anything can be placed on the top of the furniture
public function get stackable():Boolean
a flag (Boolean) that tells if the furniture can be stepped on by characters (Character)
public function get walkable():Boolean
furniture elevation (Number)
public function get elevation():Number
is the furniture clickable or not (Boolean)
public function get selectable():Boolean
stores the tiles (Tile) occupied by the furniture
public function set occupiedTiles( arr: Array ):Void