com.theoworlds.builder.World

com.theoworlds.builder.World

World class -- main class that builds an isometric tile--based map

Version

1.0

Author

© TheoWorlds.com, 2007--2008.

Summary
com.theoworlds.builder.WorldWorld class -- main class that builds an isometric tile--based map
Variables
addEventListener
removeEventListener
dispatchEvent
_onEnterFrameBeaconForCursor
_highestFloorTileElevation
_mapNamethe name of th map.
_worldLogiclink the class (WorldLogic) that processes the user UI events (mouse, keyboard) can be extended to add more functionality (generation ond processing on World actions)
_sizeXworld/map/room size X = columns(:Number)
_sizeYworld/map/room size Y = rows(:Number)
_scrollYscrollable world/map/room area(:Number) (the sub--area of the big map that fits on the the screen) defined in rows/cols.
_scrollXscrollable world/map/room area(:Number) (the sub--area of the big map that fits on the the screen) defined in rows/cols.
_scrollBufferthe number(:Number) of pixels left till the edge of the map when the auto--scrolling starts.
_tileWidthtile size (width(:Number) ).
_tileHeighttile size (height(:Number) ).
halfTileWidth
halfTileHeight
_tileDiagonal
_worldMCthe main movieclip(:MovieClip), inside which the World is created
_maskMCmask movieclip(:MovieClip) (it’s existence and parametters are set in the World constructor) the movie that may contains the mask for the map, to hide parts of it (that are bigger than the visible area)
_containerMCthe top container MC(:MovieClip) that contains everything
_backgroundMCmap background(:MovieClip)
_floorMCmc(:MovieClip) containing all the floor tiles
debugLayerMC
_mouseMCmovieclip (:MovieClip)for the cursor (World._cursorMC) changing its depth we can use it for different purposes (for example now it points only on the floor, but is covered by characters and furniture)
_cursorMCcursor movieclip(:MovieClip).
_contentMCthe main mc(:MovieClip) containing furniture(:Furniture) and characters(:Character)
_furnitureCursorMC
_chatMCcontains the chat bubbles (:TextBubble)
_foregroundMCmap foreground (:MovieClip)
_furnitureStandingOrderListthe array that stores the ORDER in which the furniture is added to the map when its created (the Map Editor generates this order.
_aFloorthe array that contains the floor tiles _aFloor[n][m] = Tile (Tile)
_aFurniturethe array that contains the furniture _aFurniture[n][m] = Furniture (Furniture)
_aCharactersthe array that contains the characters _aCharacters[n][m] = Characters (Character)
_lastObjectIDtracks the objects IDs used for Worlds initialization, for generating the names of the movieclips
_charactersListcharacter list for a quick reference (instead of looping the whole aCharacters 3D array) OPT define List object with lookup and other functions
_charactersAreSelectablea flag -- not used yet
_rollOveredCharacterlink to the Character.
_iCharacterthe reference to “I” (main) character
_worldOrigintop left corner of the map (the ground level)
_tbControllerclass--controller of the text bubbles
MAX_ROW_ZORDERa z--order value calculated on initialization for speed
_scrollWidththe width of the scroll area.
_scrollHeightthe height of the scroll area.
_maxScrollXmaximum scroll value in X
_maxScrollYmaximum scroll value in Y
Functions
World
initinitializes the World object
maskMapMask map -- can be used hide the area of the map that is out of the scroll area
maskHitTesttrue if the click was on the mask and false otherwise (or if the mask is not present)
initAllTilesloops the aFloor array and adds all the tiles to the map
addTileputs a floor tile on the map If ts:TileSettings contains links to the Library ( see the Library method for more details ), then a MovieClip (MovieClip) and loads the image into it
removeTileremoves a tile using its zorder since it’s unique and doesn’t change (tileID = _zorder) note that the Characters use characterID, because their zorder always changes (they move)
initAllFurnitureloops the aFurniture array and adds all the furniture objects to the map
addFurnitureadds furniture objects to the map
furnitureConfigurationAnalyser
getRegistrationPoint
onClickFurniturefurniture with _selectable == true calls this function directly and passes a link to itself as its parametter World uses it to detect ABOVE which exact tile is locate the clicked part of the furniture and passes this information to the WorldLogic (WorldLogic), where the actions to that event are decided
initAllCharactersloops the aCharacters array and adds all the charracters objects to the map
addCharacteradds a character to the map
Variables
testCount
Functions
netCharacterCorrectioncalled fromTheoChat (optimize it?)
placeCharacterinstantly places an existing character on a tile (Tile) (and removes from a previous one)
moveNetCharacter* used in TheoChat * tells the character to move to a tile * this method uses overloading * if tileX, tileY is send -- move to that tile * if direction is sent -- move to that direction * call moveCharacter(ID, tileX, tileY) * or moveCharacter(ID, null, null, direction) * @param netID (String) -- network ID of the character(Character) * @param tileX position on the map (column:Number) * @param tileY position on the map (row:Number) * @param dir reduntant? 
moveCharactermakes a character move
changeCharacterStatenot used right now.
sendMoveToServer
characterOnMovedthe character informs where he moved to (can be used for adjusting the text bubbles for example)
characterDidNotAchieveDestinationTilethe character informes what point he wasn’t able to reach The Worlds checks why and generates an event //TODO -- right now the cause for this situation is another character, but can be extended to include furniture
tilesAreNeighborschecks if the two tiles are next to each other
stopCharacterstops the character
doCharacterActionexecutes actions like sit, dance...
isValidActionnot used anymore since the WorldLogic decides things like that.
onRollOverCharactercalled by the Character, if (will be implemented in the next release) _charactersAreSelectable == true (World._charactersAreSelectable) Character.selectable == true (Character.selectable)
onRollOutCharactercalled by the Character, if (will be implemented in the next release) _charactersAreSelectable == true (World._charactersAreSelectable) Character.selectable == true (Character.selectable)
onClickCharactercalled by the Character, if (will be implemented in the next release) _charactersAreSelectable == true (World._charactersAreSelectable) Character.selectable == true (Character.selectable)
getRollOveredCharactercalled by the Character, if (will be implemented in the next release) _charactersAreSelectable == true Character.selectable == true;
setBordersForTextBubbleControllerusually those parametters coincide with the mask parametters, or the area defined in the GUI
netCharacterSaytext message received from another character
characterSayshows a character text message
generateObjectNamegenerates names for tile, furniture, characters
removeCharacterremoves a character (Character)
removeCharacterByNetIDremoves network characters (Character)
removeObjectremoves an object
removeAllFurnitureRemoves all the furniture (Furniture)
removeAllCharactersRemoves all the characters (Character)
scrollMapscrolls the map
getAreaWidthcalculates the width of a floor area
getAreaHeightcalculates the height of a floor area
Properties
mapScrollXthe ammount of scroll applied to the world/map in pixels
mapScrollYthe container position (Number) (movieclip containing the World objects -- floor(Tile), furniture(Furniture), characters(Character))
Functions
centerMapcenters the map around a given tile
isInLeftHorizontalScrollAreafinds out in the point is too close to the enge -- within “scroll buffer’ zone x, y -- absolute position on the map is inside the left scroll buffer zone
isInRightHorizontalScrollAreafinds out in the point is too close to the enge -- within “scroll buffer’ zone x, y -- absolute position on the map is inside the left scroll buffer zone
isInHorizontalScrollAreafinds out in the point is too close to the enge -- within “scroll buffer’ zone x, y -- absolute position on the map is inside the left scroll buffer zone
isInTopVerticalScrollAreathe same as in isInHorizontalScrollArea
isInBottomVerticalScrollAreathe same as in isInHorizontalScrollArea
isInVerticalScrollAreathe same as in isInHorizontalScrollArea
isInScrollAreathe same as in isInHorizontalScrollArea, but for all the directions
getTileCoordinatesfind the tile x:y coorinates -- tile.location tileX, tileY are counted from 1, not from 0
getTileElevationcalculates the tile elevation (the sum of the whole floor tiles stack elevation)
getRandomWalkableTile// TODO used to place a character on a random tile -- has to be optimized
_getTileMapLocation
getTileMapLocation
__getTileMapLocationfind the tile row/column on the map -- tileX, tileY by a coordinate
getNearestWalkableTilereturns the nearest walkable tile
getNearestEmptyTilereturn nearest walkable tile tile without any furniture on it
getNextTilereturns next tile coordinates to any direction.
isWalkableTilecheck if the tile is walkable and returns the cause if its not the codes for non--walkable tiles are defined in Constants
getCharactersOnTilea situation when two characters are on the same tile is possible.
isValidTilechecks if it’s a valid tile coordinate (within a map, etc).
showCursorshows the mouse cursor depending on mouse events
getNextZOrdercalculates next available z--order for each object on a given tile tileX, tileY should be >0 and <=map width/height
getStackElZOrdercalculates the zorder of the element by it’s tile and position in the stack a -- the array (aCharacter, aFurniture or aFloor)
getObjectBaseZOrdergets the base z--order
getObjectMaxZOrdergets the maximum z--order
removeObjectFromStackremoves the map object (character/furniture/floor) from the tile stack array simple Array.splice() shifts the items above the splice element down, closing the “gap” from the removed object their z--order has to be updated to be in sync with the stack order
getObjectStackOrderreturns the the 3rd index of aCharacters array -- his number in the “stack” of characters on the same tile
getMapObjectByIDgets the movieclip of a map object
getObjectArrayreturns aCharacters for CHARACTER_OBJECT and so on...
getContainerMCreturns the container movieclip for particular Map Object
clearclears the World
Properties
iCharacterreturn the main (“I”) character
iCharactersets the main character OPT needs to be removed from here?
mouseXgetting local _xmouse coordinates
mouseYgetting local _ymouse
tileWidthgetting tile width
tileHeightgetting tile height
worldLogic
worldLogiclink to the WorldLogic (WorldLogic)
charactersAreSelectablesets the flag so the character can be selectable (not implemented yet)
charactersAreSelectablereturns the flag value (Boolean)
isMaskedreturns the flag value (Boolean)
Functions
getTileActionNamereturns the NAME of the action, that is saved in the BASE tile (depends on the actions that are assigned to the furniture on that tile) this method is needed for a better performance -- a name is enough in most cases otherwise we would need to use the heavy method World.getTileAction
getTileActionretuns the copy action (Object).
getCharactersList
Properties
EVENT_CHARACTER_MOVE
EVENT_CHARACTER_STOP
EVENT_CHARACTER_CHANGE_SETTINGS
EVENT_CHARACTER_DESTINATION_CORRECTION
EVENT_CHARACTER_ARRIVED_TELEPORT
EVENT_CHARACTER_IS_CLICKED
Functions
onRollOverFurniture
onRollOutFurniture
traceMapArrays
fillTilesArea// TODO
getTileMCNOT WORKING
drawDebugGridNOT WORKING

Variables

addEventListener

var addEventListener: Function

removeEventListener

var removeEventListener: Function

dispatchEvent

var dispatchEvent: Function

_onEnterFrameBeaconForCursor

private var _onEnterFrameBeaconForCursor: MovieClip

_highestFloorTileElevation

private var _highestFloorTileElevation: Number

_mapName

private var _mapName: String

the name of th map.  Not used right now.

_worldLogic

private var _worldLogic: WorldLogic

link the class (WorldLogic) that processes the user UI events (mouse, keyboard) can be extended to add more functionality (generation ond processing on World actions)

_sizeX

private var _sizeX: Number

world/map/room size X = columns(:Number)

_sizeY

private var _sizeY: Number

world/map/room size Y = rows(:Number)

_scrollY

private var _scrollY: Number

scrollable world/map/room area(:Number) (the sub--area of the big map that fits on the the screen) defined in rows/cols. if not defined -- the map is not scrollable

_scrollX

private var _scrollX: Number

scrollable world/map/room area(:Number) (the sub--area of the big map that fits on the the screen) defined in rows/cols. if not defined -- the map is not scrollable

_scrollBuffer

private var _scrollBuffer: Number

the number(:Number) of pixels left till the edge of the map when the auto--scrolling starts. if =0 -- the maps scrolls just when reaching the edge of it.

_tileWidth

private var _tileWidth: Number

tile size (width(:Number) ). recomended to be Odd to avoid /2 rounding errors

_tileHeight

private var _tileHeight: Number

tile size (height(:Number) ). recomended to be Odd to avoid /2 rounding errors

halfTileWidth

public var halfTileWidth: Number

halfTileHeight

public var halfTileHeight: Number

_tileDiagonal

private var _tileDiagonal: Number

_worldMC

private var _worldMC: MovieClip

the main movieclip(:MovieClip), inside which the World is created

_maskMC

private var _maskMC: MovieClip

mask movieclip(:MovieClip) (it’s existence and parametters are set in the World constructor) the movie that may contains the mask for the map, to hide parts of it (that are bigger than the visible area)

_containerMC

private var _containerMC: MovieClip

the top container MC(:MovieClip) that contains everything

_backgroundMC

private var _backgroundMC: MovieClip

map background(:MovieClip)

_floorMC

private var _floorMC: MovieClip

mc(:MovieClip) containing all the floor tiles

debugLayerMC

public var debugLayerMC: MovieClip

_mouseMC

private var _mouseMC: MovieClip

movieclip (:MovieClip)for the cursor (World._cursorMC) changing its depth we can use it for different purposes (for example now it points only on the floor, but is covered by characters and furniture)

_cursorMC

private var _cursorMC: MovieClip

cursor movieclip(:MovieClip).  In the *.FLA Library there should be a linked movieclip called “cursor” if it’s not present, it will be created automatically

_contentMC

private var _contentMC: MovieClip

the main mc(:MovieClip) containing furniture(:Furniture) and characters(:Character)

_furnitureCursorMC

private var _furnitureCursorMC: MovieClip

_chatMC

private var _chatMC: MovieClip

contains the chat bubbles (:TextBubble)

_foregroundMC

private var _foregroundMC: MovieClip

map foreground (:MovieClip)

_furnitureStandingOrderList

private var _furnitureStandingOrderList: Array

the array that stores the ORDER in which the furniture is added to the map when its created (the Map Editor generates this order. if the map is created manually, then the furniture will have to be placed in the XML is the right order).  This is necessary for displaying the objects correctly.  For example, so the vase is on the table, and not vice versa -- the table has to be added first, and only after that the vase

_aFloor

private var _aFloor: Array

the array that contains the floor tiles _aFloor[n][m] = Tile (Tile)

_aFurniture

private var _aFurniture: Array

the array that contains the furniture _aFurniture[n][m] = Furniture (Furniture)

_aCharacters

private var _aCharacters: Array

the array that contains the characters _aCharacters[n][m] = Characters (Character)

_lastObjectID

private var _lastObjectID: Array

tracks the objects IDs used for Worlds initialization, for generating the names of the movieclips

_charactersList

private var _charactersList: Array

character list for a quick reference (instead of looping the whole aCharacters 3D array) OPT define List object with lookup and other functions

_charactersAreSelectable

private var _charactersAreSelectable: Boolean

a flag -- not used yet

_rollOveredCharacter

private var _rollOveredCharacter: Character

link to the Character.  Works if _charactersAreSelectable == true.  Not used yet.

_iCharacter

private var _iCharacter: Character

the reference to “I” (main) character

_worldOrigin

private var _worldOrigin: Point

top left corner of the map (the ground level)

_tbController

private var _tbController: TextBubbleController

class--controller of the text bubbles

MAX_ROW_ZORDER

private var MAX_ROW_ZORDER: Number

a z--order value calculated on initialization for speed

_scrollWidth

private var _scrollWidth: Number

the width of the scroll area.  Calculated on initialization

_scrollHeight

private var _scrollHeight: Number

the height of the scroll area.  Calculated on initialization

_maxScrollX

private var _maxScrollX: Number

maximum scroll value in X

_maxScrollY

private var _maxScrollY: Number

maximum scroll value in Y

Functions

World

public function World(target: MovieClip,
sizeX: Number,
sizeY: Number,
tHeight: Number,
tWidth: Number,
mapBGImage: Object,
mapFGImage: Object,
aFloor: Array,
aFurniture: Array,
aCharacters: Array,
origin: Point,
scrollX: Number,
scrollY: Number,
scrollBuffer: Number,
masking: Boolean,
maskMinX: Number,
maskMinY: Number,
maskMaxX: Number,
maskMaxY: Number)

Parameters

targetroot MC for the World (MovieClip)
sizeXnumber of columns
sizeYnumber of rows
tileHeighttile height
tileWidthtileWidth
mapBGImageobject with background image params {url:String, _x:Number, _y:Number}
mapFGImageobject with foreground image params {url:String, _x:Number, _y:Number}
_aFloor3D array containing floor tile objects (Array)
_aFurniture3D array containing furniture objects (Array)
_aCharacters3D array containig characters objects (Array)
originWorld origin (Point)
scrollXdefines the scrollable area in columns
scrollYdefines the scrollable area in rows
scrollBuffer
maskingflag -- is a mask used or not
maskXdefines the masked area of the world in columns
maskYdefines the masked area of the world in rows
maskMaxXthe maximum Х for the mask
maskMaxYthe maximum Y for the mask

init

private function init(target: MovieClip,
sizeX: Number,
sizeY: Number,
tileHeight: Number,
tileWidth: Number,
mapBGImage: Object,
mapFGImage: Object,
aFloor: Array,
aFurniture: Array,
aCharacters: Array,
origin: Point,
scrollX: Number,
scrollY: Number,
scrollBuffer: Number,
masking: Boolean,
maskMinX: Number,
maskMinY: Number,
maskMaxX: Number,
maskMaxY: Number):Void

initializes the World object

maskMap

private function maskMap(minX: Number,
minY: Number,
maxX: Number,
maxY: Number):Void

Mask map -- can be used hide the area of the map that is out of the scroll area

Parameters

maxX
maxY
minX
minY

maskHitTest

public function maskHitTest():Boolean

Returns

true if the click was on the mask and false otherwise (or if the mask is not present)

initAllTiles

private function initAllTiles(a: Array):Void

loops the aFloor array and adds all the tiles to the map

Parameters

aFloor(Array)

addTile

private function addTile(tileX: Number ,
tileY: Number ,
ts: TileSettings):Tile

puts a floor tile on the map If ts:TileSettings contains links to the Library ( see the Library method for more details ), then a MovieClip (MovieClip) and loads the image into it

Parameters

tileXNumber position on the map (row)
tileYNumber posituin in the map (column)
tsTileSettings

removeTile

private function removeTile(tileID: Number):Void

removes a tile using its zorder since it’s unique and doesn’t change (tileID = _zorder) note that the Characters use characterID, because their zorder always changes (they move)

Parameters

tileIDNumber

initAllFurniture

private function initAllFurniture(a: Array):Void

loops the aFurniture array and adds all the furniture objects to the map

Parameters

aFurniture(Array)

addFurniture

public function addFurniture(tileX: Number,
tileY: Number,
fs: FurnitureSettings): Furniture

adds furniture objects to the map

Parameters

tileX
tileY
fs(FurnitureSettings)

Returns

(Furniture)

furnitureConfigurationAnalyser

function furnitureConfigurationAnalyser(configuration: String,
registrationTile: String,
destTile: Point):Array

Parameters

configuration-- the string from ХML Library
registrationTile= the string from XML Library
detTile-- the tile on which to place the furniture

Returns

Object {occupiedTiles:Array} -- the array that stores all the tiles the furniture covered

getRegistrationPoint

private function getRegistrationPoint(configuration: Array):Point

Parameters

configuration- array it’s organized like the one in v1

Returns

Point Point(x, y) == Array[x][y]

onClickFurniture

public function onClickFurniture(f: Furniture):Void

furniture with _selectable == true calls this function directly and passes a link to itself as its parametter World uses it to detect ABOVE which exact tile is locate the clicked part of the furniture and passes this information to the WorldLogic (WorldLogic), where the actions to that event are decided

Parameters

f(Furniture)

initAllCharacters

private function initAllCharacters(a: Array):Void

loops the aCharacters array and adds all the charracters objects to the map

Parameters

aCharacters(Array)

addCharacter

public function addCharacter(tileX: Number,
tileY: Number,
cs: CharacterSettings): Character

adds a character to the map

Parameters

tileX
tileY
cs(CharacterSettings)

Returns

Character (Character)

Variables

testCount

var testCount: Number

Functions

netCharacterCorrection

public function netCharacterCorrection(cs: CharacterSettings,
cause: MapObjectSettings):Void

called fromTheoChat (optimize it?) in case a conflict situation happened (due to net latency)

Parameters

cs(CharacterSettings) -- character that can’t reach the destination
cause(MapObject) -- the cause of the conflict // TODO -- right now the cause it another character (that got to the destination and occupied it before, most likely), but in the future it can be extended to include furniture (for cases when it changes or moves as well). 

placeCharacter

public function placeCharacter(characterID: Number,
tileX: Number,
tileY: Number,
dir: Number,
phase: Number,
action: String,
actionParams: Object):Void

instantly places an existing character on a tile (Tile) (and removes from a previous one)

Parameters

characterID(Number)
tileXposition on the map (column:Number)
tileYposition on the map (row:Number)
dir(Number) direction the character is facing
phase(Number) the animation phase
actionthe action the character(Character) is performing
actionParams(Object) -- not used right now, but can be used to pass details about the action

moveNetCharacter

public function moveNetCharacter(netID: String,
tileX: Number,
tileY: Number,
dir: Number,
nonStop: Boolean,
latency: Number):Void

* used in TheoChat * tells the character to move to a tile * this method uses overloading * if tileX, tileY is send -- move to that tile * if direction is sent -- move to that direction * call moveCharacter(ID, tileX, tileY) * or moveCharacter(ID, null, null, direction) * @param netID (String) -- network ID of the character(Character) * @param tileX position on the map (column:Number) * @param tileY position on the map (row:Number) * @param dir reduntant? needs to be deleted?  * @param nonStop redundant? needs to be deleted?  * @param latency the total network lag time (adding the two characters personal lags -- the “I” one and the indicated one) -- used to accelerate the character to compensate for the lag

moveCharacter

public function moveCharacter(characterID: Number,
tileX: Number,
tileY: Number,
dir: Number,
nonStop: Boolean,
latency: Number):Void

makes a character move

Parameters

characterID(Number)
tileXposition on the map (column:Number)
tileYposition on the map (row:Number)
dir(Number) direction the character is facing
nonStopredundant?
latencythe total network lag time (adding the two characters personal lags -- the “I” one and the indicated one) -- used to accelerate the character to compensate for the lag

changeCharacterState

public function changeCharacterState(cs: CharacterSettings):Void

not used right now. can be used to update character settings like the clothes and pass them to the server

Parameters

cs(CharacterSettings)

sendMoveToServer

public function sendMoveToServer(c: Character):Void

Parameters

character(Character)

characterOnMoved

public function characterOnMoved(characterID: Number,
tileX: Number,
tileY: Number):Void

the character informs where he moved to (can be used for adjusting the text bubbles for example)

Parameters

characterID(Number)
tileXposition on the map (column:Number)
tileYposition on the map (row:Number)

characterDidNotAchieveDestinationTile

public function characterDidNotAchieveDestinationTile(c: Character,
destTile: Point):Void

the character informes what point he wasn’t able to reach The Worlds checks why and generates an event //TODO -- right now the cause for this situation is another character, but can be extended to include furniture

Parameters

c(Character)
destTile(Point) Point(tileX, tileY)

tilesAreNeighbors

public function tilesAreNeighbors(t1: Point,
t2: Point):Boolean

checks if the two tiles are next to each other

Parameters

t1(Point) -- Point(tileX, tileY)
t2(Point)

Returns

Boolean

stopCharacter

public function stopCharacter(c: Character):Void

stops the character

Parameters

c(Character)

doCharacterAction

public function doCharacterAction(characterID: Number,
action: String,
params: Object):Void

executes actions like sit, dance...

Parameters

characterID-- (Number)
action-- action name (@link String)
params-- (Object)

isValidAction

public function isValidAction(characterID: Number,
action: Number,
params: Object):Boolean

not used anymore since the WorldLogic decides things like that.  To be removed?

Parameters

characterID-- (Number)
action-- action name (String)
params-- (Object)

onRollOverCharacter

public function onRollOverCharacter(c: Character):Void

called by the Character, if (will be implemented in the next release) _charactersAreSelectable == true (World._charactersAreSelectable) Character.selectable == true (Character.selectable)

Parameters

c(Character)

onRollOutCharacter

public function onRollOutCharacter(c: Character):Void

called by the Character, if (will be implemented in the next release) _charactersAreSelectable == true (World._charactersAreSelectable) Character.selectable == true (Character.selectable)

Parameters

c(Character)

onClickCharacter

public function onClickCharacter(c: Character):Void

called by the Character, if (will be implemented in the next release) _charactersAreSelectable == true (World._charactersAreSelectable) Character.selectable == true (Character.selectable)

Parameters

c(Character)

getRollOveredCharacter

public function getRollOveredCharacter():Character

called by the Character, if (will be implemented in the next release) _charactersAreSelectable == true Character.selectable == true;

Parameters

c(Character)

setBordersForTextBubbleController

private function setBordersForTextBubbleController(x: Number,
y: Number,
width: Number,
height: Number):Void

usually those parametters coincide with the mask parametters, or the area defined in the GUI

Parameters

x(Number)
y(Number)
width(Number)
height(Number)

netCharacterSay

public function netCharacterSay(netID: String,
text: String,
params: Object):Void

text message received from another character

Parameters

netIDof character (Character),received from the server
text(String)
params(Object) -- not used yet

characterSay

public function characterSay(characterID: Number,
text: String,
params: Object):Void

shows a character text message

Parameters

characterID-- gets it when the World attaces a character (Character)
text(String)
params(Object) -- not used yet

generateObjectName

private function generateObjectName(oType: Number,
ID: Number):String

generates names for tile, furniture, characters

Parameters

oType-- the object type: (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)
ID(Number)

removeCharacter

public function removeCharacter(characterID: Number):Void

removes a character (Character)

Parameters

characterID(Number)

removeCharacterByNetID

public function removeCharacterByNetID(netID: String):Void

removes network characters (Character)

Parameters

netID(String)

removeObject

private function removeObject(oType: Number,
objectID: Number):Void

removes an object

Parameters

oType-- types (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)
objectID(Number)

removeAllFurniture

public function removeAllFurniture():Void

Removes all the furniture (Furniture)

removeAllCharacters

public function removeAllCharacters():Void

Removes all the characters (Character)

scrollMap

public function scrollMap(shiftX: Number,
shiftY: Number,
autoAdjust: Boolean):Void

scrolls the map

Parameters

shiftX(Number)
shiftY(Number)
autoAdjust(Boolean)

getAreaWidth

public static function getAreaWidth(cols: Number): Number

calculates the width of a floor area

Parameters

cols(Number) -- the ammount of columns

Returns

the width (Number) of a floor area

getAreaHeight

public static function getAreaHeight(rows: Number): Number

calculates the height of a floor area

Parameters

rows(Number) -- the ammount of rows

Returns

the height (Number) of a floor area

Properties

mapScrollX

public function get mapScrollX():Number

the ammount of scroll applied to the world/map in pixels

Returns

the container position (Number) (movieclip containing the World objects -- floor(Tile), furniture(Furniture), characters(Character))

mapScrollY

public function get mapScrollY():Number

Returns

the container position (Number) (movieclip containing the World objects -- floor(Tile), furniture(Furniture), characters(Character))

Functions

centerMap

public function centerMap(tileX : Number,
tileY: Number):Void

centers the map around a given tile

Parameters

tileX(Number)
tileY(Number)

isInLeftHorizontalScrollArea

public function isInLeftHorizontalScrollArea(x: Number): Boolean

finds out in the point is too close to the enge -- within “scroll buffer’ zone x, y -- absolute position on the map is inside the left scroll buffer zone

Parameters

x(Number)

Returns

(Boolean)

isInRightHorizontalScrollArea

public function isInRightHorizontalScrollArea(x: Number): Boolean

finds out in the point is too close to the enge -- within “scroll buffer’ zone x, y -- absolute position on the map is inside the left scroll buffer zone

Parameters

x(Number)

Returns

Boolean

isInHorizontalScrollArea

public function isInHorizontalScrollArea(x: Number): Boolean

finds out in the point is too close to the enge -- within “scroll buffer’ zone x, y -- absolute position on the map is inside the left scroll buffer zone

Parameters

x(Number)

Returns

Boolean

isInTopVerticalScrollArea

public function isInTopVerticalScrollArea(y: Number): Boolean

the same as in isInHorizontalScrollArea

Parameters

y(Number)

Returns

Boolean

isInBottomVerticalScrollArea

public function isInBottomVerticalScrollArea(y: Number): Boolean

the same as in isInHorizontalScrollArea

Parameters

y(Number)

Returns

Boolean

isInVerticalScrollArea

public function isInVerticalScrollArea(y: Number): Boolean

the same as in isInHorizontalScrollArea

Parameters

y(Number)

Returns

Boolean

isInScrollArea

public function isInScrollArea(x: Number,
y: Number): Boolean

the same as in isInHorizontalScrollArea, but for all the directions

Parameters

x(Number)
y(Number)

Returns

Boolean

getTileCoordinates

public function getTileCoordinates(tileX: Number,
tileY: Number): Point

find the tile x:y coorinates -- tile.location tileX, tileY are counted from 1, not from 0

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)

Returns

Point

getTileElevation

public function getTileElevation(tileX: Number,
tileY: Number,
includeFurniture: Boolean): Number

calculates the tile elevation (the sum of the whole floor tiles stack elevation)

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)
includeFurniture(Boolean), by default is false

Returns

Number

getRandomWalkableTile

public function getRandomWalkableTile(preferableDir: Number):Point

// TODO used to place a character on a random tile -- has to be optimized

Parameters

preferableDir(Number)

Returns

Point(col, roow)

_getTileMapLocation

public function _getTileMapLocation(x: Number,
y: Number,
elevationEnabled: Boolean,
furnitureElevationEnabled: Boolean):Point

getTileMapLocation

public function getTileMapLocation(x: Number,
y: Number,
elevationEnabled: Boolean,
furnitureElevationEnabled: Boolean):Point

__getTileMapLocation

public function __getTileMapLocation(x: Number,
y: Number,
elevationEnabled: Boolean,
furnitureElevationEnabled: Boolean):Point

find the tile row/column on the map -- tileX, tileY by a coordinate

Parameters

x-- an integer (Number) that sets the x coordinate
y-- an integer (Number) that sets the y coordinate
elevationEnabled(Boolean)
furnitureElevationEnabled(Boolean)

Returns

Point(col, row)

getNearestWalkableTile

public function getNearestWalkableTile(tileX: Number,
tileY: Number):Point

returns the nearest walkable tile

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)

Returns

Point(col, row)

getNearestEmptyTile

public function getNearestEmptyTile(tileX: Number,
tileY: Number):Point

return nearest walkable tile tile without any furniture on it

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)

Returns

Point(col, row)

getNextTile

public function getNextTile(tileX: Number,
tileY: Number,
dir: Number): Point

returns next tile coordinates to any direction. tileX = point.x; tileY = point.y;

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)
dir-- derection (Number)

Returns

Point(col, row)

isWalkableTile

public function isWalkableTile(tileX: Number,
tileY: Number,
ignoreCharacter: Boolean):Boolean

check if the tile is walkable and returns the cause if its not the codes for non--walkable tiles are defined in Constants

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)
ignoreCharacter(Boolean)

Returns

Boolean

getCharactersOnTile

public function getCharactersOnTile(tileX: Number,
tileY: Number):Array

a situation when two characters are on the same tile is possible.  This method is used to get the array of the characters located on the same tile

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)

Returns

array of characters (Character) (can be empty)

isValidTile

public function isValidTile(tileX: Number,
tileY: Number): Boolean

checks if it’s a valid tile coordinate (within a map, etc).

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)

Returns

Boolean

showCursor

private function showCursor():Void

shows the mouse cursor depending on mouse events

getNextZOrder

private function getNextZOrder(tileX: Number,
tileY: Number,
oType: Number): Number

calculates next available z--order for each object on a given tile tileX, tileY should be >0 and <=map width/height

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)
oType-- the object type: (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)

Returns

Number

getStackElZOrder

private function getStackElZOrder(tileX: Number,
tileY: Number,
oType: Number,
stackOrder: Number): Number

calculates the zorder of the element by it’s tile and position in the stack a -- the array (aCharacter, aFurniture or aFloor)

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)
oType-- the object type: (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)
stackOrder(Number)

Returns

Number

getObjectBaseZOrder

private function getObjectBaseZOrder(objectType: Number): Number

gets the base z--order

Parameters

oType-- the object type: (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)

Returns

Number

getObjectMaxZOrder

private function getObjectMaxZOrder(objectType: Number): Number

gets the maximum z--order

Parameters

oType-- the object type: (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)

Returns

Number

removeObjectFromStack

private function removeObjectFromStack(tileX: Number,
tileY: Number,
objectType: Number,
stackOrder: Number):Number

removes the map object (character/furniture/floor) from the tile stack array simple Array.splice() shifts the items above the splice element down, closing the “gap” from the removed object their z--order has to be updated to be in sync with the stack order

Parameters

tileX-- position on the map (column:Number)
tileY-- position on the map (row:Number)
oType-- the object type: (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)
stackOrder-- the link to the stack array inside -- aCharacter[x][y], aFurniture[x][y], or aFloor[x][y]

Returns

Number

getObjectStackOrder

private function getObjectStackOrder(ID: Number,
objectType: Number): Number

returns the the 3rd index of aCharacters array -- his number in the “stack” of characters on the same tile

Parameters

ID(Number)
oType-- the object type: (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)

Returns

Number

getMapObjectByID

private function getMapObjectByID(ID: Number,
objectType: Number): MapObject

gets the movieclip of a map object

Parameters

ID(Number)
oType-- the object type: (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)

Returns

(MapObject)

getObjectArray

public function getObjectArray(objectType: Number): Array

returns aCharacters for CHARACTER_OBJECT and so on... public -- because it’s accessed from WorldLogic

Parameters

oType-- the object type: (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)

Returns

Array

getContainerMC

public function getContainerMC(objectType: Number): MovieClip

returns the container movieclip for particular Map Object

Parameters

oType-- the object type: (Constants.CHARACTER_OBJECT, Constants.FURNITURE_OBJECT, Constants.FLOOR_OBJECT)

Returns

Number

clear

public function clear():Void

clears the World

Properties

iCharacter

public function get iCharacter(): Character

return the main (“I”) character

Returns

(Character)

iCharacter

public function set iCharacter(c: Character):Void

sets the main character OPT needs to be removed from here?

Parameters

c(Character)

mouseX

public function get mouseX():Number

Returns

getting local _xmouse coordinates

mouseY

public function get mouseY():Number

Returns

getting local _ymouse

tileWidth

public function get tileWidth(): Number

Returns

getting tile width

tileHeight

public function get tileHeight(): Number

Returns

getting tile height

worldLogic

public function set worldLogic(w: WorldLogic):Void

Parameters

w(WorldLogic)

worldLogic

public function get worldLogic():WorldLogic

Returns

link to the WorldLogic (WorldLogic)

charactersAreSelectable

public function set charactersAreSelectable(b: Boolean):Void

sets the flag so the character can be selectable (not implemented yet)

Parameters

b(Boolean)

charactersAreSelectable

public function get charactersAreSelectable():Boolean

Returns

returns the flag value (Boolean)

isMasked

public function get isMasked():Boolean

Returns

returns the flag value (Boolean)

Functions

getTileActionName

public function getTileActionName(x,
y):String

returns the NAME of the action, that is saved in the BASE tile (depends on the actions that are assigned to the furniture on that tile) this method is needed for a better performance -- a name is enough in most cases otherwise we would need to use the heavy method World.getTileAction

Returns

action name (String)

getTileAction

public function getTileAction(x,
y):Object

Returns

retuns the copy action (Object).  It is recommended to use World.getTileActionName

getCharactersList

public function getCharactersList():Array

Properties

EVENT_CHARACTER_MOVE

public static function get EVENT_CHARACTER_MOVE():String

EVENT_CHARACTER_STOP

public static function get EVENT_CHARACTER_STOP():String

EVENT_CHARACTER_CHANGE_SETTINGS

public static function get EVENT_CHARACTER_CHANGE_SETTINGS():String

EVENT_CHARACTER_DESTINATION_CORRECTION

public static function get EVENT_CHARACTER_DESTINATION_CORRECTION():String

EVENT_CHARACTER_ARRIVED_TELEPORT

public static function get EVENT_CHARACTER_ARRIVED_TELEPORT():String

EVENT_CHARACTER_IS_CLICKED

public static function get EVENT_CHARACTER_IS_CLICKED():String

Functions

onRollOverFurniture

public function onRollOverFurniture(f: Furniture):Void

onRollOutFurniture

public function onRollOutFurniture(f: Furniture):Void

traceMapArrays

public function traceMapArrays():Void

fillTilesArea

private function fillTilesArea(initObj: TileSettings,
startRow: Number,
startCol: Number,
endRow: Number,
endCol: Number):Void

// TODO

getTileMC

private function getTileMC(tileX: Number,
tileY: Number): Tile

NOT WORKING

drawDebugGrid

private function drawDebugGrid():Void

NOT WORKING

WorldEditor class - main MapEditor class
var addEventListener: Function
var removeEventListener: Function
var dispatchEvent: Function
private var _onEnterFrameBeaconForCursor: MovieClip
private var _highestFloorTileElevation: Number
private var _mapName: String
the name of th map.
private var _worldLogic: WorldLogic
link the class (WorldLogic) that processes the user UI events (mouse, keyboard) can be extended to add more functionality (generation ond processing on World actions)
WorldLogic class -- a.k.a God or Game Logic defines the rules of this World and what happens in different situations reacts to the mouse and the keyboard inputs and takes decisions
private var _sizeX: Number
world/map/room size X = columns(:Number)
private var _sizeY: Number
world/map/room size Y = rows(:Number)
private var _scrollY: Number
scrollable world/map/room area(:Number) (the sub--area of the big map that fits on the the screen) defined in rows/cols.
private var _scrollX: Number
scrollable world/map/room area(:Number) (the sub--area of the big map that fits on the the screen) defined in rows/cols.
private var _scrollBuffer: Number
the number(:Number) of pixels left till the edge of the map when the auto--scrolling starts.
private var _tileWidth: Number
tile size (width(:Number) ).
private var _tileHeight: Number
tile size (height(:Number) ).
public var halfTileWidth: Number
public var halfTileHeight: Number
private var _tileDiagonal: Number
private var _worldMC: MovieClip
the main movieclip(:MovieClip), inside which the World is created
private var _maskMC: MovieClip
mask movieclip(:MovieClip) (it’s existence and parametters are set in the World constructor) the movie that may contains the mask for the map, to hide parts of it (that are bigger than the visible area)
private var _containerMC: MovieClip
the top container MC(:MovieClip) that contains everything
private var _backgroundMC: MovieClip
map background(:MovieClip)
private var _floorMC: MovieClip
mc(:MovieClip) containing all the floor tiles
public var debugLayerMC: MovieClip
private var _mouseMC: MovieClip
movieclip (:MovieClip)for the cursor (World._cursorMC) changing its depth we can use it for different purposes (for example now it points only on the floor, but is covered by characters and furniture)
private var _cursorMC: MovieClip
cursor movieclip(:MovieClip).
private var _contentMC: MovieClip
the main mc(:MovieClip) containing furniture(:Furniture) and characters(:Character)
Furniture class - furniture main class
Character class -- character/avatar main class
private var _furnitureCursorMC: MovieClip
private var _chatMC: MovieClip
contains the chat bubbles (:TextBubble)
TextBubble class - chat “bubbles” that appear above characters when they “talk”
private var _foregroundMC: MovieClip
map foreground (:MovieClip)
private var _furnitureStandingOrderList: Array
the array that stores the ORDER in which the furniture is added to the map when its created (the Map Editor generates this order.
private var _aFloor: Array
the array that contains the floor tiles _aFloor[n][m] = Tile (Tile)
Tile class -- floor tile main class
private var _aFurniture: Array
the array that contains the furniture _aFurniture[n][m] = Furniture (Furniture)
private var _aCharacters: Array
the array that contains the characters _aCharacters[n][m] = Characters (Character)
private var _lastObjectID: Array
tracks the objects IDs used for Worlds initialization, for generating the names of the movieclips
private var _charactersList: Array
character list for a quick reference (instead of looping the whole aCharacters 3D array) OPT define List object with lookup and other functions
private var _charactersAreSelectable: Boolean
a flag -- not used yet
private var _rollOveredCharacter: Character
link to the Character.
private var _iCharacter: Character
the reference to “I” (main) character
private var _worldOrigin: Point
top left corner of the map (the ground level)
private var _tbController: TextBubbleController
class--controller of the text bubbles
private var MAX_ROW_ZORDER: Number
a z--order value calculated on initialization for speed
private var _scrollWidth: Number
the width of the scroll area.
private var _scrollHeight: Number
the height of the scroll area.
private var _maxScrollX: Number
maximum scroll value in X
private var _maxScrollY: Number
maximum scroll value in Y
public function World(target: MovieClip,
sizeX: Number,
sizeY: Number,
tHeight: Number,
tWidth: Number,
mapBGImage: Object,
mapFGImage: Object,
aFloor: Array,
aFurniture: Array,
aCharacters: Array,
origin: Point,
scrollX: Number,
scrollY: Number,
scrollBuffer: Number,
masking: Boolean,
maskMinX: Number,
maskMinY: Number,
maskMaxX: Number,
maskMaxY: Number)
private function init(target: MovieClip,
sizeX: Number,
sizeY: Number,
tileHeight: Number,
tileWidth: Number,
mapBGImage: Object,
mapFGImage: Object,
aFloor: Array,
aFurniture: Array,
aCharacters: Array,
origin: Point,
scrollX: Number,
scrollY: Number,
scrollBuffer: Number,
masking: Boolean,
maskMinX: Number,
maskMinY: Number,
maskMaxX: Number,
maskMaxY: Number):Void
initializes the World object
private function maskMap(minX: Number,
minY: Number,
maxX: Number,
maxY: Number):Void
Mask map -- can be used hide the area of the map that is out of the scroll area
public function maskHitTest():Boolean
true if the click was on the mask and false otherwise (or if the mask is not present)
private function initAllTiles(a: Array):Void
loops the aFloor array and adds all the tiles to the map
private function addTile(tileX: Number ,
tileY: Number ,
ts: TileSettings):Tile
puts a floor tile on the map If ts:TileSettings contains links to the Library ( see the Library method for more details ), then a MovieClip (MovieClip) and loads the image into it
LibraryItem class i- stores and manages a collection of LibraryItem objects organized in sub-libraries - those are map objects like Floor tiles, Furniture and Characters that can be placed on maps
private function removeTile(tileID: Number):Void
removes a tile using its zorder since it’s unique and doesn’t change (tileID = _zorder) note that the Characters use characterID, because their zorder always changes (they move)
private function initAllFurniture(a: Array):Void
loops the aFurniture array and adds all the furniture objects to the map
public function addFurniture(tileX: Number,
tileY: Number,
fs: FurnitureSettings): Furniture
adds furniture objects to the map
function furnitureConfigurationAnalyser(configuration: String,
registrationTile: String,
destTile: Point):Array
private function getRegistrationPoint(configuration: Array):Point
public function onClickFurniture(f: Furniture):Void
furniture with _selectable == true calls this function directly and passes a link to itself as its parametter World uses it to detect ABOVE which exact tile is locate the clicked part of the furniture and passes this information to the WorldLogic (WorldLogic), where the actions to that event are decided
private function initAllCharacters(a: Array):Void
loops the aCharacters array and adds all the charracters objects to the map
public function addCharacter(tileX: Number,
tileY: Number,
cs: CharacterSettings): Character
adds a character to the map
var testCount: Number
public function netCharacterCorrection(cs: CharacterSettings,
cause: MapObjectSettings):Void
called fromTheoChat (optimize it?)
public function placeCharacter(characterID: Number,
tileX: Number,
tileY: Number,
dir: Number,
phase: Number,
action: String,
actionParams: Object):Void
instantly places an existing character on a tile (Tile) (and removes from a previous one)
public function moveNetCharacter(netID: String,
tileX: Number,
tileY: Number,
dir: Number,
nonStop: Boolean,
latency: Number):Void
* used in TheoChat * tells the character to move to a tile * this method uses overloading * if tileX, tileY is send -- move to that tile * if direction is sent -- move to that direction * call moveCharacter(ID, tileX, tileY) * or moveCharacter(ID, null, null, direction) * @param netID (String) -- network ID of the character(Character) * @param tileX position on the map (column:Number) * @param tileY position on the map (row:Number) * @param dir reduntant? 
public function moveCharacter(characterID: Number,
tileX: Number,
tileY: Number,
dir: Number,
nonStop: Boolean,
latency: Number):Void
makes a character move
public function changeCharacterState(cs: CharacterSettings):Void
not used right now.
public function sendMoveToServer(c: Character):Void
public function characterOnMoved(characterID: Number,
tileX: Number,
tileY: Number):Void
the character informs where he moved to (can be used for adjusting the text bubbles for example)
public function characterDidNotAchieveDestinationTile(c: Character,
destTile: Point):Void
the character informes what point he wasn’t able to reach The Worlds checks why and generates an event //TODO -- right now the cause for this situation is another character, but can be extended to include furniture
public function tilesAreNeighbors(t1: Point,
t2: Point):Boolean
checks if the two tiles are next to each other
public function stopCharacter(c: Character):Void
stops the character
public function doCharacterAction(characterID: Number,
action: String,
params: Object):Void
executes actions like sit, dance...
public function isValidAction(characterID: Number,
action: Number,
params: Object):Boolean
not used anymore since the WorldLogic decides things like that.
public function onRollOverCharacter(c: Character):Void
called by the Character, if (will be implemented in the next release) _charactersAreSelectable == true (World._charactersAreSelectable) Character.selectable == true (Character.selectable)
public function get selectable():Boolean
checks if the furniture is selectable (Character._selectable)
public function onRollOutCharacter(c: Character):Void
called by the Character, if (will be implemented in the next release) _charactersAreSelectable == true (World._charactersAreSelectable) Character.selectable == true (Character.selectable)
public function onClickCharacter(c: Character):Void
called by the Character, if (will be implemented in the next release) _charactersAreSelectable == true (World._charactersAreSelectable) Character.selectable == true (Character.selectable)
public function getRollOveredCharacter():Character
called by the Character, if (will be implemented in the next release) _charactersAreSelectable == true Character.selectable == true;
private function setBordersForTextBubbleController(x: Number,
y: Number,
width: Number,
height: Number):Void
usually those parametters coincide with the mask parametters, or the area defined in the GUI
public function netCharacterSay(netID: String,
text: String,
params: Object):Void
text message received from another character
public function characterSay(characterID: Number,
text: String,
params: Object):Void
shows a character text message
private function generateObjectName(oType: Number,
ID: Number):String
generates names for tile, furniture, characters
public function removeCharacter(characterID: Number):Void
removes a character (Character)
public function removeCharacterByNetID(netID: String):Void
removes network characters (Character)
private function removeObject(oType: Number,
objectID: Number):Void
removes an object
public function removeAllFurniture():Void
Removes all the furniture (Furniture)
public function removeAllCharacters():Void
Removes all the characters (Character)
public function scrollMap(shiftX: Number,
shiftY: Number,
autoAdjust: Boolean):Void
scrolls the map
public static function getAreaWidth(cols: Number): Number
calculates the width of a floor area
public static function getAreaHeight(rows: Number): Number
calculates the height of a floor area
public function get mapScrollX():Number
the ammount of scroll applied to the world/map in pixels
public function get mapScrollY():Number
the container position (Number) (movieclip containing the World objects -- floor(Tile), furniture(Furniture), characters(Character))
public function centerMap(tileX : Number,
tileY: Number):Void
centers the map around a given tile
public function isInLeftHorizontalScrollArea(x: Number): Boolean
finds out in the point is too close to the enge -- within “scroll buffer’ zone x, y -- absolute position on the map is inside the left scroll buffer zone
public function isInRightHorizontalScrollArea(x: Number): Boolean
finds out in the point is too close to the enge -- within “scroll buffer’ zone x, y -- absolute position on the map is inside the left scroll buffer zone
public function isInHorizontalScrollArea(x: Number): Boolean
finds out in the point is too close to the enge -- within “scroll buffer’ zone x, y -- absolute position on the map is inside the left scroll buffer zone
public function isInTopVerticalScrollArea(y: Number): Boolean
the same as in isInHorizontalScrollArea
public function isInBottomVerticalScrollArea(y: Number): Boolean
the same as in isInHorizontalScrollArea
public function isInVerticalScrollArea(y: Number): Boolean
the same as in isInHorizontalScrollArea
public function isInScrollArea(x: Number,
y: Number): Boolean
the same as in isInHorizontalScrollArea, but for all the directions
public function getTileCoordinates(tileX: Number,
tileY: Number): Point
find the tile x:y coorinates -- tile.location tileX, tileY are counted from 1, not from 0
public function getTileElevation(tileX: Number,
tileY: Number,
includeFurniture: Boolean): Number
calculates the tile elevation (the sum of the whole floor tiles stack elevation)
public function getRandomWalkableTile(preferableDir: Number):Point
// TODO used to place a character on a random tile -- has to be optimized
public function _getTileMapLocation(x: Number,
y: Number,
elevationEnabled: Boolean,
furnitureElevationEnabled: Boolean):Point
public function getTileMapLocation(x: Number,
y: Number,
elevationEnabled: Boolean,
furnitureElevationEnabled: Boolean):Point
public function __getTileMapLocation(x: Number,
y: Number,
elevationEnabled: Boolean,
furnitureElevationEnabled: Boolean):Point
find the tile row/column on the map -- tileX, tileY by a coordinate
public function getNearestWalkableTile(tileX: Number,
tileY: Number):Point
returns the nearest walkable tile
public function getNearestEmptyTile(tileX: Number,
tileY: Number):Point
return nearest walkable tile tile without any furniture on it
public function getNextTile(tileX: Number,
tileY: Number,
dir: Number): Point
returns next tile coordinates to any direction.
public function isWalkableTile(tileX: Number,
tileY: Number,
ignoreCharacter: Boolean):Boolean
check if the tile is walkable and returns the cause if its not the codes for non--walkable tiles are defined in Constants
public function getCharactersOnTile(tileX: Number,
tileY: Number):Array
a situation when two characters are on the same tile is possible.
public function isValidTile(tileX: Number,
tileY: Number): Boolean
checks if it’s a valid tile coordinate (within a map, etc).
private function showCursor():Void
shows the mouse cursor depending on mouse events
private function getNextZOrder(tileX: Number,
tileY: Number,
oType: Number): Number
calculates next available z--order for each object on a given tile tileX, tileY should be >0 and <=map width/height
private function getStackElZOrder(tileX: Number,
tileY: Number,
oType: Number,
stackOrder: Number): Number
calculates the zorder of the element by it’s tile and position in the stack a -- the array (aCharacter, aFurniture or aFloor)
private function getObjectBaseZOrder(objectType: Number): Number
gets the base z--order
private function getObjectMaxZOrder(objectType: Number): Number
gets the maximum z--order
private function removeObjectFromStack(tileX: Number,
tileY: Number,
objectType: Number,
stackOrder: Number):Number
removes the map object (character/furniture/floor) from the tile stack array simple Array.splice() shifts the items above the splice element down, closing the “gap” from the removed object their z--order has to be updated to be in sync with the stack order
private function getObjectStackOrder(ID: Number,
objectType: Number): Number
returns the the 3rd index of aCharacters array -- his number in the “stack” of characters on the same tile
private function getMapObjectByID(ID: Number,
objectType: Number): MapObject
gets the movieclip of a map object
public function getObjectArray(objectType: Number): Array
returns aCharacters for CHARACTER_OBJECT and so on...
public function getContainerMC(objectType: Number): MovieClip
returns the container movieclip for particular Map Object
public function clear():Void
clears the World
public function get iCharacter(): Character
return the main (“I”) character
public function get mouseX():Number
getting local _xmouse coordinates
public function get mouseY():Number
getting local _ymouse
public function get tileWidth(): Number
getting tile width
public function get tileHeight(): Number
getting tile height
public function set worldLogic(w: WorldLogic):Void
public function set charactersAreSelectable(b: Boolean):Void
sets the flag so the character can be selectable (not implemented yet)
public function get isMasked():Boolean
returns the flag value (Boolean)
public function getTileActionName(x,
y):String
returns the NAME of the action, that is saved in the BASE tile (depends on the actions that are assigned to the furniture on that tile) this method is needed for a better performance -- a name is enough in most cases otherwise we would need to use the heavy method World.getTileAction
public function getTileAction(x,
y):Object
retuns the copy action (Object).
public function getCharactersList():Array
public static function get EVENT_CHARACTER_MOVE():String
public static function get EVENT_CHARACTER_STOP():String
public static function get EVENT_CHARACTER_CHANGE_SETTINGS():String
public static function get EVENT_CHARACTER_DESTINATION_CORRECTION():String
public static function get EVENT_CHARACTER_ARRIVED_TELEPORT():String
public static function get EVENT_CHARACTER_IS_CLICKED():String
public function onRollOverFurniture(f: Furniture):Void
public function onRollOutFurniture(f: Furniture):Void
public function traceMapArrays():Void
private function fillTilesArea(initObj: TileSettings,
startRow: Number,
startCol: Number,
endRow: Number,
endCol: Number):Void
// TODO
private function getTileMC(tileX: Number,
tileY: Number): Tile
NOT WORKING
private function drawDebugGrid():Void
NOT WORKING
TileSettings class stores the settings of a Floor tile object
FurnitureSettings class stores the settings of a Furniture object
CharacterSettings class stores the settings of a Character object
base class for all map objects classes on the map : Tile, Furniture, Character
static function get CHARACTER_OBJECT():Number
static function get FURNITURE_OBJECT():Number
static function get FLOOR_OBJECT():Number
Close