Methods
(static) generate(gameId, floorIdx, opts)
Generate a new floor (runs on the server and the browser)
Parameters:
Name | Type | Description |
---|---|---|
gameId |
The game id for the game we want to generate | |
floorIdx |
The index of floor we want to generate | |
opts |
object | The options of the specific generators |
- Source:
(static) load(gameId, floorIdx, sock, username)
Load everything in the browser
Parameters:
Name | Type | Description |
---|---|---|
gameId |
The game id for the game we want to load | |
floorIdx |
The index of floor we want to load | |
sock |
The connection to the game server | |
username |
The username of the current player |
- Source:
_diffState(idRawKey, idKey, current, wanted, create)
Take an array of objects and update it to match another array (keeps objects with matching ids)
Parameters:
Name | Type | Description |
---|---|---|
idRawKey |
string | The property to use as a key |
idKey |
string | The property to use as a key |
current |
Array.<object> | The current array of objects |
wanted |
Array.<object> | The array of objects we want |
create |
function | A function that creates an instance of a current object from an instance of a wanted object |
- Source:
_initRendering()
Do any rendering setup and add all sprites to the stage
- Source:
generateMonsters(floor)
Puts a monster in half of all "rooms".
Occurs twice upon floor generation, shouldnt cause errors though.
Parameters:
Name | Type | Description |
---|---|---|
floor |
Floor | The floor to add monsters to |
- Source:
getViewport() → {object}
Get the current viewport
- Source:
Returns:
{x, y}
- Type
- object
handleState()
Update our state to match the server's state
- Source:
setViewport(x, y)
Set the viewport of the cient (ie the coordiates for the center of their screen)
Parameters:
Name | Type | Description |
---|---|---|
x |
number | |
y |
number |
- Source:
update()
Render/update the game
- Source: