Members
advanceTurn
[Code that handles everything needed when a turn is advanced.]
- Source:
Constants
- Source:
(constant) DEFAULT_PERSON_ATTACK :number
Default attack damage
Type:
- number
- Default Value:
- 2
- Source:
(constant) DEFAULT_PERSON_HEALTH :number
Default health
Type:
- number
- Default Value:
- 100
- Source:
(constant) DEFAULT_PERSON_SIGHT_DISTANCE :number
Default sight distance
Type:
- number
- Default Value:
- 4
- Source:
(constant) LOG_FPS :boolean
Boolean indicating whether fps will be logged
Type:
- boolean
- Default Value:
- false
- Source:
Main
[Code that initializes and starts the game.]
- Source:
(constant) MAP_MOVE_SPEED :number
Speed that the map attempts to center at
Type:
- number
- Default Value:
- 1
- Source:
(constant) MAX_ENEMY_DISTANCE :number
Maximum enemy distance
Type:
- number
- Default Value:
- 8
- Source:
(constant) MAX_HIGH_SCORES :number
[MAX_HIGH_SCORES The max amount of high scores kept track of]
Type:
- number
- Default Value:
- 5
- Source:
(constant) MAX_TURN_COUNTER :number
when a player's turn counter reaches this turn in a frame, it is their turn.
Type:
- number
- Default Value:
- 100
- Source:
(constant) MIN_ENEMY_DISTANCE :number
Minimum enemy distance
Type:
- number
- Default Value:
- 8
- Source:
(constant) NUM_ENEMIES :number
Number of enemies to be instantiated
Type:
- number
- Default Value:
- 1
- Source:
(constant) NUM_PLAYERS :number
Number of players to be instantiated
Type:
- number
- Default Value:
- 1
- Source:
(constant) TILESET_FILE_TYPE :string
Tileset file extension
Type:
- string
- Default Value:
- .png
- Source:
(constant) TREASURE_VALUE :number
[TREASURE_VALUE The amount of points finding the treasure gives to the player.]
Type:
- number
- Default Value:
- 1000
- Source:
Methods
advanceTurn()
[advanceTurn Function used in default game engine for determining next player turn]
- Source:
calculateDamage(attackingObject, defendingObject)
Used to calculate damage during an attack
Parameters:
| Name | Type | Description |
|---|---|---|
attackingObject |
Object | |
defendingObject |
Object |
- Source:
destroy() → {void}
Removes element
- Source:
Returns:
[]
- Type
- void
fixViewport()
[fixViewport Fixes the viewport on a window resize event]
- Source:
Form(x, y, list, @optional)
the form class is responsible for rendering html inputs to the dom and provides an interface for retrieving this information
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | coorddinate |
y |
number | coordinate |
list |
function | of fields |
@optional |
Object | options object |
- Source:
getPositionCSS() → {string}
Returns a string with position information in css form
- Source:
Returns:
- Type
- string
getValue(value) → {string}
[getValue gets the value of an internal form field]
Parameters:
| Name | Type | Description |
|---|---|---|
value |
value |
- Source:
Returns:
- Type
- string
handleComplete()
[handleComplete Handler for preload complete]
- Source:
handleTick(event)
[handleTick Our main game loop]
Parameters:
| Name | Type | Description |
|---|---|---|
event |
TickEvent |
- Source:
hide() → {Widget}
Hides element
- Source:
Returns:
- Type
- Widget
init()
[init Call everything needed to start a game, initially. might be different from initvars later. called by loader handlecomplete handler]
- Source:
initVars()
[initVars Initialize all variables needed for a new game to start]
- Source:
isSelectionInSelectableBounds(playerObject, x, y) → {boolean}
True if selection location is in selectable area bounds
Parameters:
| Name | Type | Description |
|---|---|---|
playerObject |
Player | |
x |
number | |
y |
number |
- Source:
Returns:
- Type
- boolean
MapLink(x, y, graphic, link, startPointNumber)
[MapLink description]
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | x-coordinate |
y |
number | y-coordinate |
graphic |
string | manifest ID for graphic |
link |
string | name of JSON file containing link data |
startPointNumber |
number |
- Source:
namePlayers(numPlayers, names)
The menus for naming each player. creates a menu with a text field for player name input]
Parameters:
| Name | Type | Description |
|---|---|---|
numPlayers |
number | The number of players chosen, the dialog will be displayed this number of times. |
names |
Array.<string> | The list of names added recursively in this function. |
- Source:
removeSelectableArea()
Removes selectable area
- Source:
render()
[render renders the form to the screen]
- Source:
selectMap(previous)
Select map menu form. This function is not used
Parameters:
| Name | Type | Description |
|---|---|---|
previous |
function | previous menu item, this menu hides |
- Source:
selectPlayers(previous)
The menu for selecting the number of players
Parameters:
| Name | Type | Description |
|---|---|---|
previous |
function | previous menu item, that this menu hides |
- Source:
show() → {void}
Shows element
- Source:
Returns:
[]
- Type
- void
showSelectableArea(playerObject)
Updates the selectable area around a player
Parameters:
| Name | Type | Description |
|---|---|---|
playerObject |
Player |
- Source:
startMenu()
Main menu form, which is displayed at the beginning of the game
- Source:
StartPoint(x, y, startPointNumber)
[StartPoint description]
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | x-position |
y |
number | y-position |
startPointNumber |
number |
- Source:
tickActions()
Run on each frame rendering in main loop
- Source:
updateFogOfWar(playerObject)
Updates the renderer's fog of war around a player's position
Parameters:
| Name | Type | Description |
|---|---|---|
playerObject |
Player |
- Source:
values() → {Object}
[values returns the values of all fields within a form]
- Source:
Returns:
- Type
- Object
Widget(options)
Widget is a 'abstract class used to construct Dom based ui element classes and control their position on screen'
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object | object with x, y, container and el |
- Source: