Game
Creates an instance of the game
Constructor Summary
Public Constructor | ||
public |
constructor(client: Client) Keep track of the game logic and the HTML5 canvas |
Member Summary
Public Members | ||
public |
Controls the game music and sfx |
|
public |
A reference to the chat bubbles controller |
|
public |
An instance of the client application |
|
public |
Returns server/config.json => devClient value |
|
public |
An array of entities in the game |
|
public |
guild: Guild A reference to a guild |
|
public |
An ID used to identify the player after they've been given a handshake by the Node server |
|
public |
Used to display additional information on the screen (ie level up and hits and health/exp regeneration) |
|
public |
Controls all of the game's input |
|
public |
Controls the interface in the game |
|
public |
Last time (used for renderer??) |
|
public |
Whether or not the map is loaded |
|
public |
An instance of the game's map |
|
public |
An array of mesages from the web socket |
|
public |
Used to find paths of entities |
|
public |
An instance of the player |
|
public |
An instance of the game's player handler |
|
public |
The pointer shown on the HTML5 canvas |
|
public |
How many players are in the game, defaults to -1 |
|
public |
True if there is currently pvp combat |
|
public |
Whether or not the game is ready |
|
public |
An instance of the renderer |
|
public |
shop: * |
|
public |
An instance of the web socket used to talk to the node server |
|
public |
Whether or not the game is started |
|
public |
A reference to the player's LocalStorage |
|
public |
Used for rendering fame ticks |
|
public |
An instance of the updater |
|
public |
zoning: Zoning Used to figure out direction |
Method Summary
Public Methods | ||
public |
animationCallback(id: *, info: *) |
|
public |
audioCallback(song: *) |
|
public |
bankCallback(opcode: *, info: *) |
|
public |
blinkCallback(instance: *) |
|
public |
chatCallback(info: *) |
|
public |
combatCallback(data: *) |
|
public |
Connect to the nodeJS server and setup all the server to client callback messages |
|
public |
|
|
public |
deathCallback(id: *) |
|
public |
despawnCallback(id: Number): Boolean Callback for removing a spawned entity |
|
public |
enchantCallback(opcode: *, info: *) |
|
public |
entityListCallback(data: Array<Entity>): Boolean Callback for when the list of entities is done loading and adds the new entities to the screen |
|
public |
equipmentCallback(action: Number, info: Object): Boolean Callback for when player equipment is done loading |
|
public |
experienceCallback(info: *) |
|
public |
findPath(character: *, x: *, y: *, ignores: *): * |
|
public |
getCamera(): * |
|
public |
getEntityAt(x: *, y: *, ignoreSelf: *): * |
|
public |
getScaleFactor(): * |
|
public |
getSprite(spriteName: *): * |
|
public |
getStorage(): * |
|
public |
getStoragePassword(): * |
|
public |
getStorageUsername(): * |
|
public |
guildCallback(opcode: *, info: *) |
|
public |
handleDisconnection(noError: *) This function is responsible for handling sudden disconnects of a player whilst in the game, not menu-based errors. |
|
public |
handshakeCallback(data: Messages): Boolean Callback for when the server has acknowledged the client connection then it creates the player object, makes sure the map is loaded, and if the user is registering or logging in it handles player registration or login requests |
|
public |
hasRemember(): * |
|
public |
healCallback(info: *) |
|
public |
|
|
public |
inventoryCallback(opcode: *, info: *) |
|
public |
Load all of the game controllers |
|
public |
Load the game map data |
|
public |
Load the HTML5 canvas renderer layers for:
|
|
public |
|
|
public |
Callback for when the map data is done loading |
|
public |
moveCharacter(character: *, x: *, y: *) |
|
public |
movePlayer(x: *, y: *) |
|
public |
movementCallback(data: Object<Messages>): Boolean Callback for entity movement |
|
public |
|
|
public |
notificationCallback(opcode: *, message: *) |
|
public |
npcCallback(opcode: *, info: *) |
|
public |
onInput(inputType: *, data: *) |
|
public |
pointerCallback(opcode: *, info: *) |
|
public |
pointsCallback(data: *) |
|
public |
populationCallback(population: *) |
|
public |
postLoad() Call this after the player has been welcomed by the server and the client received the connection. |
|
public |
projectileCallback(opcode: *, info: *) |
|
public |
pvpCallback(id: *, pvp: *) |
|
public |
questCallback(opcode: *, info: *) |
|
public |
resize() |
|
public |
respawn() |
|
public |
respawnCallback(id: *, x: *, y: *) |
|
public |
setAudio(audio: *) |
|
public |
setBubble(bubble: *) |
|
public |
setEntityController(entities: *) |
|
public |
setInfo(info: *) |
|
public |
setInput(input: *) |
|
public |
setInterface(intrface: *) |
|
public |
setMessages(messages: *) |
|
public |
setPathfinder(pathfinder: *) |
|
public |
setPlayerMovement(direction: *) |
|
public |
setPointer(pointer: *) |
|
public |
setRenderer(renderer: *) |
|
public |
setSocket(socket: *) |
|
public |
setStorage(storage: *) |
|
public |
setUpdater(updater: *) |
|
public |
shopCallback(opcode: *, info: *) |
|
public |
spawnCallback(data: Object): Boolean Triggered when an entity has finished being spawned |
|
public |
Start the game |
|
public |
stop() Stop the game, sets started and ready to false |
|
public |
syncCallback(playerEntity: Entity<Player>): Boolean Callback for when server side sync is done. |
|
public |
teleportCallback(data: Object<Messages>): Boolean Callback for player teleport |
|
public |
tick() Calls the renderer to draw to the HTML5 canvas if the game is ready and requests animations if the game is started |
|
public |
tradeWith(player: *) |
|
public |
Resets all of the controllers, storage and entities in the game. |
|
public |
welcomeCallback(playerData: Object): Boolean The callback for when the welcome message for brand new players is done. |
Public Constructors
Public Members
public id: Number source
An ID used to identify the player after they've been given a handshake by the Node server
public info: Info source
Used to display additional information on the screen (ie level up and hits and health/exp regeneration)
public shop: * source
Public Methods
public animationCallback(id: *, info: *) source
Params:
Name | Type | Attribute | Description |
id | * | ||
info | * |
public audioCallback(song: *) source
Params:
Name | Type | Attribute | Description |
song | * |
public bankCallback(opcode: *, info: *) source
Params:
Name | Type | Attribute | Description |
opcode | * | ||
info | * |
public blinkCallback(instance: *) source
Params:
Name | Type | Attribute | Description |
instance | * |
public chatCallback(info: *) source
Params:
Name | Type | Attribute | Description |
info | * |
public combatCallback(data: *) source
Params:
Name | Type | Attribute | Description |
data | * |
public connect(): Boolean source
Connect to the nodeJS server and setup all the server to client callback messages
public createPlayer() source
public deathCallback(id: *) source
Params:
Name | Type | Attribute | Description |
id | * |
public despawnCallback(id: Number): Boolean source
Callback for removing a spawned entity
Params:
Name | Type | Attribute | Description |
id | Number | the id of the entity that needs to be removed |
public enchantCallback(opcode: *, info: *) source
Params:
Name | Type | Attribute | Description |
opcode | * | ||
info | * |
public entityListCallback(data: Array<Entity>): Boolean source
Callback for when the list of entities is done loading and adds the new entities to the screen
public equipmentCallback(action: Number, info: Object): Boolean source
Callback for when player equipment is done loading
public experienceCallback(info: *) source
Params:
Name | Type | Attribute | Description |
info | * |
public findPath(character: *, x: *, y: *, ignores: *): * source
Params:
Name | Type | Attribute | Description |
character | * | ||
x | * | ||
y | * | ||
ignores | * |
Return:
* |
public getEntityAt(x: *, y: *, ignoreSelf: *): * source
Params:
Name | Type | Attribute | Description |
x | * | ||
y | * | ||
ignoreSelf | * |
Return:
* |
public getSprite(spriteName: *): * source
Params:
Name | Type | Attribute | Description |
spriteName | * |
Return:
* |
public guildCallback(opcode: *, info: *) source
Params:
Name | Type | Attribute | Description |
opcode | * | ||
info | * |
public handleDisconnection(noError: *) source
This function is responsible for handling sudden disconnects of a player whilst in the game, not menu-based errors.
Params:
Name | Type | Attribute | Description |
noError | * |
public handshakeCallback(data: Messages): Boolean source
Callback for when the server has acknowledged the client connection then it creates the player object, makes sure the map is loaded, and if the user is registering or logging in it handles player registration or login requests
Params:
Name | Type | Attribute | Description |
data | Messages | server network message |
public healCallback(info: *) source
Params:
Name | Type | Attribute | Description |
info | * |
public implementStorage() source
public inventoryCallback(opcode: *, info: *) source
Params:
Name | Type | Attribute | Description |
opcode | * | ||
info | * |
public loadRenderer(): Boolean source
Load the HTML5 canvas renderer layers for:
- background
- foreground
- text
- entities
- cursor
public loadedSpritesCallback() source
public moveCharacter(character: *, x: *, y: *) source
Params:
Name | Type | Attribute | Description |
character | * | ||
x | * | ||
y | * |
public movePlayer(x: *, y: *) source
Params:
Name | Type | Attribute | Description |
x | * | ||
y | * |
public networkCallback() source
public notificationCallback(opcode: *, message: *) source
Params:
Name | Type | Attribute | Description |
opcode | * | ||
message | * |
public npcCallback(opcode: *, info: *) source
Params:
Name | Type | Attribute | Description |
opcode | * | ||
info | * |
public onInput(inputType: *, data: *) source
Params:
Name | Type | Attribute | Description |
inputType | * | ||
data | * |
public pointerCallback(opcode: *, info: *) source
Params:
Name | Type | Attribute | Description |
opcode | * | ||
info | * |
public pointsCallback(data: *) source
Params:
Name | Type | Attribute | Description |
data | * |
public populationCallback(population: *) source
Params:
Name | Type | Attribute | Description |
population | * |
public postLoad() source
Call this after the player has been welcomed by the server and the client received the connection.
public projectileCallback(opcode: *, info: *) source
Params:
Name | Type | Attribute | Description |
opcode | * | ||
info | * |
public pvpCallback(id: *, pvp: *) source
Params:
Name | Type | Attribute | Description |
id | * | ||
pvp | * |
public questCallback(opcode: *, info: *) source
Params:
Name | Type | Attribute | Description |
opcode | * | ||
info | * |
public resize() source
public respawn() source
public respawnCallback(id: *, x: *, y: *) source
Params:
Name | Type | Attribute | Description |
id | * | ||
x | * | ||
y | * |
public setAudio(audio: *) source
Params:
Name | Type | Attribute | Description |
audio | * |
public setBubble(bubble: *) source
Params:
Name | Type | Attribute | Description |
bubble | * |
public setEntityController(entities: *) source
Params:
Name | Type | Attribute | Description |
entities | * |
public setInfo(info: *) source
Params:
Name | Type | Attribute | Description |
info | * |
public setInput(input: *) source
Params:
Name | Type | Attribute | Description |
input | * |
public setInterface(intrface: *) source
Params:
Name | Type | Attribute | Description |
intrface | * |
public setMessages(messages: *) source
Params:
Name | Type | Attribute | Description |
messages | * |
public setPathfinder(pathfinder: *) source
Params:
Name | Type | Attribute | Description |
pathfinder | * |
public setPlayerMovement(direction: *) source
Params:
Name | Type | Attribute | Description |
direction | * |
public setPointer(pointer: *) source
Params:
Name | Type | Attribute | Description |
pointer | * |
public setRenderer(renderer: *) source
Params:
Name | Type | Attribute | Description |
renderer | * |
public setSocket(socket: *) source
Params:
Name | Type | Attribute | Description |
socket | * |
public setStorage(storage: *) source
Params:
Name | Type | Attribute | Description |
storage | * |
public setUpdater(updater: *) source
Params:
Name | Type | Attribute | Description |
updater | * |
public shopCallback(opcode: *, info: *) source
Params:
Name | Type | Attribute | Description |
opcode | * | ||
info | * |
public spawnCallback(data: Object): Boolean source
Triggered when an entity has finished being spawned
Params:
Name | Type | Attribute | Description |
data | Object | entity id |
public syncCallback(playerEntity: Entity<Player>): Boolean source
Callback for when server side sync is done. Used to make sure the player's information doesn't differntiate from what the server has for them
public tick() source
Calls the renderer to draw to the HTML5 canvas if the game is ready and requests animations if the game is started
public tradeWith(player: *) source
Params:
Name | Type | Attribute | Description |
player | * |
public unload(): Boolean source
Resets all of the controllers, storage and entities in the game. Stops all audio too. Sets the game to a totally blank state so that it can be initialized like a new game all over again
public welcomeCallback(playerData: Object): Boolean source
The callback for when the welcome message for brand new players is done. Loads the player data and sets their starting position then calls this.postLoad()
Params:
Name | Type | Attribute | Description |
playerData | Object | the data needed to load the player |