com.theoworlds.mapeditor.WorldEditor

com.theoworlds.mapeditor.WorldEditor

WorldEditor class - main MapEditor class

Version

1.0

Author

© TheoWorlds.com, 2007-2008.

Summary
com.theoworlds.mapeditor.WorldEditorWorldEditor class - main MapEditor class
Variables
_markedTileused for the tile editing mode
_cursorTileremembers the cursor position A very important variable - ALL functions (place/remove/show) use it it is introduced to simplify the things, since the cursor in some cases is shown at the base level and sometimes at the elevation level
_previewModeshowCursor calls the needed mode when the position of the cursor changes
_charactersToXML
_gridIsHidden
_anyCharacterLibraryParams
_movingEraser
_testMap
_previewMapObjectused for placing MapObject in the “preview” mode
_previewMapObjectIsStandable
_moveClipEventBeacon
_layerFloorIsVisible
_layerFurnitureIsVisible
_layerCharacterIsVisible
_layerFloorIsLocked
_layerFurnitureIsLocked
_layerCharacterIsLocked
_layerBackgroundIsVisible
_layerForegroundIsVisible
_layerBackgroundIsLocked
_layerForegroundIsLocked
_backgroundUrl
_foregroundUrl
_backgroundCoordinates
_foregroundCoordinates
Properties
EDITOR_ACTIONS_XML_NODE
Functions
WorldEditor
init
setClickedBaseTileAsWalkable
changeClickedBaseTileElevationchanges the clicked tile elevation
removeClickedBaseTiledeletes the base tile and everything that is placed on it //TODO - implement the deletion of multi-tile furniture when part of it is on this tile.
addMapObjectOnClickedTileAdds a map object to the map
removeMapObjectOnClickedTileremoves the objects starting from the top of the tile stack
globalEraseOnClickedTileerases from top to bottom, through all the object layers if one of the layers is locked or hidden, then it’s not erased, and the base tile is not erased either
startTestMap
finishTestMap
moveCharacterTest
startDragBackGround
stopDragBackGround
startDragForeGround
stopDragForeGround
Properties
mapName
mapName
backGroundCoordinates
foreGroundCoordinates
backGroundCoordinates
foreGroundCoordinates
semitransparentContent
charactersToXML
chatactersToXML
anyCharacterLibraryParams
Functions
loadBackGroundLoads the background layer
loadForeGroundLoads the foreground layer
clearLayerClears the whole layer of objects of one type
showGridShows the tiles grid
hideGridHides the tiles grid
stopPreviewStops the “preview” mode
startFloorPreviewFloor object preview
floorPreviewMode
startCharacterPreviewCharacter object preview
characterPreviewMode
startFurniturePreviewFurniture object preview
furniturePreviewMode
setLayerVisibility*hide/show an object layer
setLayerLock*lock/unlock an object layer
setContinuosErasingModeallows or not the erasing of the layer when moving the mouse
broadcastBackGroundCoordinates
broadcastForeGroundCoordinates
showCursorshows the mouse cursor depending on mouse events
getMapXML
addCharacter
addFurniture
addTile
convertActionsToXMLNode

Variables

_markedTile

private var _markedTile: Tile

used for the tile editing mode

_cursorTile

private var _cursorTile: Point

remembers the cursor position A very important variable - ALL functions (place/remove/show) use it it is introduced to simplify the things, since the cursor in some cases is shown at the base level and sometimes at the elevation level

_previewMode

private var _previewMode: Number

showCursor calls the needed mode when the position of the cursor changes

_charactersToXML

private var _charactersToXML: Boolean

_gridIsHidden

private var _gridIsHidden: Boolean

_anyCharacterLibraryParams

private var _anyCharacterLibraryParams: CharacterSettings
for the “preview” mode we just need a random characterwe randomly pick it from catalogue.xml

_movingEraser

private var _movingEraser: Boolean
flagerase when moving the mouse or not

_testMap

private var _testMap: Boolean
flag”preview” mode on/off (“test” mode)

_previewMapObject

private var _previewMapObject: MapObject

used for placing MapObject in the “preview” mode

_previewMapObjectIsStandable

private var _previewMapObjectIsStandable: Boolean

_moveClipEventBeacon

private var _moveClipEventBeacon: MovieClip

_layerFloorIsVisible

private var _layerFloorIsVisible: Boolean

_layerFurnitureIsVisible

private var _layerFurnitureIsVisible: Boolean

_layerCharacterIsVisible

private var _layerCharacterIsVisible: Boolean

_layerFloorIsLocked

private var _layerFloorIsLocked: Boolean

_layerFurnitureIsLocked

private var _layerFurnitureIsLocked: Boolean

_layerCharacterIsLocked

private var _layerCharacterIsLocked: Boolean

_layerBackgroundIsVisible

private var _layerBackgroundIsVisible: Boolean

_layerForegroundIsVisible

private var _layerForegroundIsVisible: Boolean

_layerBackgroundIsLocked

private var _layerBackgroundIsLocked: Boolean

_layerForegroundIsLocked

private var _layerForegroundIsLocked: Boolean

_backgroundUrl

private var _backgroundUrl: String

_foregroundUrl

private var _foregroundUrl: String

_backgroundCoordinates

private var _backgroundCoordinates: Point

_foregroundCoordinates

private var _foregroundCoordinates: Point

Properties

EDITOR_ACTIONS_XML_NODE

public static function get EDITOR_ACTIONS_XML_NODE():String

Functions

WorldEditor

public function WorldEditor(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)

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

setClickedBaseTileAsWalkable

public function setClickedBaseTileAsWalkable(b: Boolean):Void

Parameters

b- makes the clicked tile into a walkable one (the base tile - the one on wich all the map objects are placed on top) If the tile is not present - adds it If there are Floor or Furniture objects on the top, then it will always show it as walkable, for debuging

changeClickedBaseTileElevation

public function changeClickedBaseTileElevation(deltaElevation: Number):Void

changes the clicked tile elevation

Parameters

deltaElevation- elevation delta.  Ex.: “-10” makes the tile 10px lower

removeClickedBaseTile

public function removeClickedBaseTile():Void

deletes the base tile and everything that is placed on it //TODO - implement the deletion of multi-tile furniture when part of it is on this tile.  It also has to deal with stackable furniture

addMapObjectOnClickedTile

public function addMapObjectOnClickedTile(type: Number,
libID: Number,
symbolID: Number,
frame: Number,
mos: MapObjectSettings,
bitmap: BitmapData):Void

Adds a map object to the map

removeMapObjectOnClickedTile

public function removeMapObjectOnClickedTile(type: Number):Void

removes the objects starting from the top of the tile stack

Parameters

type

globalEraseOnClickedTile

public function globalEraseOnClickedTile():Void

erases from top to bottom, through all the object layers if one of the layers is locked or hidden, then it’s not erased, and the base tile is not erased either

startTestMap

public function startTestMap():Void

finishTestMap

public function finishTestMap():Void

moveCharacterTest

public function moveCharacterTest():Void

startDragBackGround

public function startDragBackGround():Void

stopDragBackGround

public function stopDragBackGround():Void

startDragForeGround

public function startDragForeGround():Void

stopDragForeGround

public function stopDragForeGround():Void

Properties

mapName

public function set mapName(s: String):Void

mapName

public function get mapName():String

backGroundCoordinates

public function get backGroundCoordinates():Point

foreGroundCoordinates

public function get foreGroundCoordinates():Point

backGroundCoordinates

public function set backGroundCoordinates(p: Point):Void

foreGroundCoordinates

public function set foreGroundCoordinates(p: Point):Void

semitransparentContent

public function set semitransparentContent(b: Boolean):Void

charactersToXML

public function set charactersToXML(b: Boolean):Void

chatactersToXML

public function get chatactersToXML():Boolean

anyCharacterLibraryParams

public function set anyCharacterLibraryParams(cs: CharacterSettings):Void

Functions

loadBackGround

public function loadBackGround(url: String):Void

Loads the background layer

Parameters

url- if undefined - delete

loadForeGround

public function loadForeGround(url: String):Void

Loads the foreground layer

Parameters

url- if undefined - delete

clearLayer

public function clearLayer(objectType: Number):Void

Clears the whole layer of objects of one type

Parameters

url- if undefined - delete

showGrid

public function showGrid():Void

Shows the tiles grid

hideGrid

public function hideGrid():Void

Hides the tiles grid

stopPreview

public function stopPreview():Void

Stops the “preview” mode

startFloorPreview

public function startFloorPreview(ts: TileSettings):Void

Floor object preview

floorPreviewMode

private function floorPreviewMode():Void

startCharacterPreview

public function startCharacterPreview(cs: CharacterSettings):Void

Character object preview

characterPreviewMode

private function characterPreviewMode():Void

startFurniturePreview

public function startFurniturePreview(fs: FurnitureSettings):Void

Furniture object preview

furniturePreviewMode

private function furniturePreviewMode():Void

setLayerVisibility

public function setLayerVisibility(mode: Number,
b: Boolean):Void

*hide/show an object layer

setLayerLock

public function setLayerLock(mode: Number,
b: Boolean):Void

*lock/unlock an object layer

setContinuosErasingMode

public function setContinuosErasingMode(b: Boolean):Void

allows or not the erasing of the layer when moving the mouse

broadcastBackGroundCoordinates

private function broadcastBackGroundCoordinates():Void

broadcastForeGroundCoordinates

private function broadcastForeGroundCoordinates():Void

showCursor

private function showCursor():Void

shows the mouse cursor depending on mouse events

getMapXML

public function getMapXML():String

addCharacter

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

addFurniture

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

addTile

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

convertActionsToXMLNode

private function convertActionsToXMLNode(actions: Object):XMLNode
World class -- main class that builds an isometric tile--based map
private var _markedTile: Tile
used for the tile editing mode
private var _cursorTile: Point
remembers the cursor position A very important variable - ALL functions (place/remove/show) use it it is introduced to simplify the things, since the cursor in some cases is shown at the base level and sometimes at the elevation level
private var _previewMode: Number
showCursor calls the needed mode when the position of the cursor changes
private var _charactersToXML: Boolean
private var _gridIsHidden: Boolean
private var _anyCharacterLibraryParams: CharacterSettings
private var _movingEraser: Boolean
private var _testMap: Boolean
private var _previewMapObject: MapObject
used for placing MapObject in the “preview” mode
private var _previewMapObjectIsStandable: Boolean
private var _moveClipEventBeacon: MovieClip
private var _layerFloorIsVisible: Boolean
private var _layerFurnitureIsVisible: Boolean
private var _layerCharacterIsVisible: Boolean
private var _layerFloorIsLocked: Boolean
private var _layerFurnitureIsLocked: Boolean
private var _layerCharacterIsLocked: Boolean
private var _layerBackgroundIsVisible: Boolean
private var _layerForegroundIsVisible: Boolean
private var _layerBackgroundIsLocked: Boolean
private var _layerForegroundIsLocked: Boolean
private var _backgroundUrl: String
private var _foregroundUrl: String
private var _backgroundCoordinates: Point
private var _foregroundCoordinates: Point
public static function get EDITOR_ACTIONS_XML_NODE():String
public function WorldEditor(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
public function setClickedBaseTileAsWalkable(b: Boolean):Void
public function changeClickedBaseTileElevation(deltaElevation: Number):Void
changes the clicked tile elevation
public function removeClickedBaseTile():Void
deletes the base tile and everything that is placed on it //TODO - implement the deletion of multi-tile furniture when part of it is on this tile.
public function addMapObjectOnClickedTile(type: Number,
libID: Number,
symbolID: Number,
frame: Number,
mos: MapObjectSettings,
bitmap: BitmapData):Void
Adds a map object to the map
public function removeMapObjectOnClickedTile(type: Number):Void
removes the objects starting from the top of the tile stack
public function globalEraseOnClickedTile():Void
erases from top to bottom, through all the object layers if one of the layers is locked or hidden, then it’s not erased, and the base tile is not erased either
public function startTestMap():Void
public function finishTestMap():Void
public function moveCharacterTest():Void
public function startDragBackGround():Void
public function stopDragBackGround():Void
public function startDragForeGround():Void
public function stopDragForeGround():Void
public function set mapName(s: String):Void
public function get backGroundCoordinates():Point
public function get foreGroundCoordinates():Point
public function set semitransparentContent(b: Boolean):Void
public function set charactersToXML(b: Boolean):Void
public function get chatactersToXML():Boolean
public function set anyCharacterLibraryParams(cs: CharacterSettings):Void
public function loadBackGround(url: String):Void
Loads the background layer
public function loadForeGround(url: String):Void
Loads the foreground layer
public function clearLayer(objectType: Number):Void
Clears the whole layer of objects of one type
public function showGrid():Void
Shows the tiles grid
public function hideGrid():Void
Hides the tiles grid
public function stopPreview():Void
Stops the “preview” mode
public function startFloorPreview(ts: TileSettings):Void
Floor object preview
private function floorPreviewMode():Void
public function startCharacterPreview(cs: CharacterSettings):Void
Character object preview
private function characterPreviewMode():Void
public function startFurniturePreview(fs: FurnitureSettings):Void
Furniture object preview
private function furniturePreviewMode():Void
public function setLayerVisibility(mode: Number,
b: Boolean):Void
*hide/show an object layer
public function setLayerLock(mode: Number,
b: Boolean):Void
*lock/unlock an object layer
public function setContinuosErasingMode(b: Boolean):Void
allows or not the erasing of the layer when moving the mouse
private function broadcastBackGroundCoordinates():Void
private function broadcastForeGroundCoordinates():Void
private function showCursor():Void
shows the mouse cursor depending on mouse events
public function getMapXML():String
public function addCharacter(tileX: Number,
tileY: Number,
cs: CharacterSettings):Character
public function addFurniture(tileX: Number,
tileY: Number,
fs: FurnitureSettings): Furniture
private function addTile(tileX: Number ,
tileY: Number ,
ts: TileSettings):Tile
private function convertActionsToXMLNode(actions: Object):XMLNode
Close