com.theoworlds.builder.WorldLogic

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

Version

1.0

Author

© TheoWorlds.com, 2007--2009.

Summary
com.theoworlds.builder.WorldLogicWorldLogic 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
Variables
addEventListener
removeEventListener
dispatchEvent
_worldlink to the World World
_lastKeyPressedthe code of the last clicked keyboard key -- needed for the walking (not used now)
_charactersMoveNonStopa flag that tells if the character keeps walking when the key is kept pressed down (not used now)
Functions
WorldLogic
onKeyDown/TODO -- add the keyboard control for walking
onKeyUp// TODO -- has to be re--written so the calls are made from GUI
onMouseDownresponds to the mouseDown event from GUI.
onClickFurnitureresponds to the click on a furniture object
isValidActionnot used anymore because the functions of this methods were moved to Character.stepAn and World.placeCharacter // TODO -- we can move it all back here, but the Character has no link to the WorldLogic
killthis method destroys the WorldLogic

Variables

addEventListener

var addEventListener: Function

removeEventListener

var removeEventListener: Function

dispatchEvent

var dispatchEvent: Function

_world

private var _world: World

link to the World World

_lastKeyPressed

private var _lastKeyPressed: Number

the code of the last clicked keyboard key -- needed for the walking (not used now)

_charactersMoveNonStop

private var _charactersMoveNonStop: Boolean

a flag that tells if the character keeps walking when the key is kept pressed down (not used now)

Functions

WorldLogic

public function WorldLogic(world: World)

onKeyDown

private function onKeyDown(_this: WorldLogic):Void

/TODO -- add the keyboard control for walking

onKeyUp

private function onKeyUp():Void

// TODO -- has to be re--written so the calls are made from GUI

onMouseDown

function onMouseDown():Void

responds to the mouseDown event from GUI.  Moves the main character.

if the GUI is not defined, we can use the WorldLogic as a listener Mouse.addListener(WorldLogic)

onClickFurniture

function onClickFurniture(f: Furniture,
p: Point):Void

responds to the click on a furniture object

Parameters

f{Furniture}
pPoint -- the point of the click is needed since the furniture can cover multiple tiles

isValidAction

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

not used anymore because the functions of this methods were moved to Character.stepAn and World.placeCharacter // TODO -- we can move it all back here, but the Character has no link to the WorldLogic

Parameters

characterID-- id of Character
action-- action name
params-- Object

kill

public function kill():Void

this method destroys the WorldLogic

var addEventListener: Function
var removeEventListener: Function
var dispatchEvent: Function
private var _world: World
link to the World World
World class -- main class that builds an isometric tile--based map
private var _lastKeyPressed: Number
the code of the last clicked keyboard key -- needed for the walking (not used now)
private var _charactersMoveNonStop: Boolean
a flag that tells if the character keeps walking when the key is kept pressed down (not used now)
public function WorldLogic(world: World)
private function onKeyDown(_this: WorldLogic):Void
/TODO -- add the keyboard control for walking
private function onKeyUp():Void
// TODO -- has to be re--written so the calls are made from GUI
function onMouseDown():Void
responds to the mouseDown event from GUI.
function onClickFurniture(f: Furniture,
p: Point):Void
responds to the click on a furniture object
public function isValidAction(characterID: Number,
action: String,
params: Object):Boolean
not used anymore because the functions of this methods were moved to Character.stepAn and World.placeCharacter // TODO -- we can move it all back here, but the Character has no link to the WorldLogic
public function kill():Void
this method destroys the WorldLogic
Furniture class - furniture main class
Character class -- character/avatar main class
Close