2014-10-24 11:19:30 +02:00
|
|
|
JSDSH currently uses two different class-trees (one for the crafty/graphical objects, one for "game" objects),
|
|
|
|
although this (and everything marked with (*)) is subject to change in the future.
|
|
|
|
|
|
|
|
The Crafty-Classes that are not defined by the library (included from jsds_crafty.js) are:
|
|
|
|
|
|
|
|
Thing: A base class, providing the Canvas- and Color-Mechanisms and positioning.
|
|
|
|
Creature: Creatures are everything tha may attack and move (that is, players and monsters)
|
|
|
|
Additional to Thing, this class provides mechanisms for moving the element by mouse or arrow-keys,
|
|
|
|
collision-control to prevent overlaps, and bindings.
|
|
|
|
(*) Furthermore, every creture-object has a variable set to the associated game-object.
|
|
|
|
|
|
|
|
The following additional functions and variables are defined in jsds_crafty.js:
|
|
|
|
|
|
|
|
last_sel: contains a reference to the game-object associated to the last clicked object.
|
|
|
|
end_init(): This function should be called as last after an adventure is loaded and initialized. Usually,
|
|
|
|
when using arrow key control, crafty moves every EACH object where it is activated.
|
|
|
|
end_init disables this control for each object of type "Creature", and sets a hook needed to work
|
|
|
|
around a bug in crafty.
|
|
|
|
reset_bug(): resets the problems with a bug in crafty that causes a key-down-event to be (constantly) triggered
|
|
|
|
when the JSDSH-Tab is the one the browser falls back to after closing another tab.
|
|
|
|
(Strange, I know…).
|
|
|
|
If this happens, DON'T CLICK ANOTHER OBJECT! Open the JS-console and run reset_bug() manually.
|
2014-10-24 17:15:10 +02:00
|
|
|
If you accidentily clicke ONE other object, it is still possible to get back to the old state
|
2014-10-24 11:19:30 +02:00
|
|
|
Manually reset_bug(), de- and refocus the window, and run reset_bug() once more.
|