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
1.0
© TheoWorlds.com, 2007--2009.
| com. | 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 |
| Variables | |
| addEventListener | |
| removeEventListener | |
| dispatchEvent | |
| _world | link to the World World |
| _lastKeyPressed | the code of the last clicked keyboard key -- needed for the walking (not used now) |
| _charactersMoveNonStop | a 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 |
| onMouseDown | responds to the mouseDown event from GUI. |
| onClickFurniture | responds to the click on a furniture object |
| isValidAction | 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 |
| kill | this method destroys the WorldLogic |
private var _world: World
link to the World World
function onClickFurniture( f: Furniture, p: Point ):Void
responds to the click on a furniture object
| f | {Furniture} |
| p | Point -- the point of the click is needed since the furniture can cover multiple tiles |
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
| characterID | -- id of Character |
| action | -- action name |
| params | -- Object |
var addEventListener: Function
var removeEventListener: Function
var dispatchEvent: Function
link to the World World
private var _world: World
the code of the last clicked keyboard key -- needed for the walking (not used now)
private var _lastKeyPressed: Number
a flag that tells if the character keeps walking when the key is kept pressed down (not used now)
private var _charactersMoveNonStop: Boolean
public function WorldLogic( world: World )
/TODO -- add the keyboard control for walking
private function onKeyDown( _this: WorldLogic ):Void
// TODO -- has to be re--written so the calls are made from GUI
private function onKeyUp():Void
responds to the mouseDown event from GUI.
function onMouseDown():Void
responds to the click on a furniture object
function onClickFurniture( f: Furniture, p: Point ):Void
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 isValidAction( characterID: Number, action: String, params: Object ):Boolean
this method destroys the WorldLogic
public function kill():Void