Function
| Static Public Summary | ||
| public |
addExperience(event: string, socket: *, room: string, player: string) Adds experience to a given player. |
|
| public |
Attempts to connect to the server. |
|
| public |
bindHandler(id: string, handlerMethod: function) Binds handlerMethod to onclick event for element id. |
|
| public |
|
|
| public |
collisionDetect(socket: *, room: string, thisPlayer: *, tempObjects: *) Runs once a frame, checks for collisions between objects and handles them accordingly. |
|
| public |
createCompound(data: *, room: string, thisPlayer: *, socket: *): * Checks if a compound can be created, deducts craft material, and returns the new compound. |
|
| public |
createPlayer(data: *): Player Creates a Player instance once the stage is fully set up and ready. |
|
| public |
createRenderAtom(data: *): * Renders a new atom. |
|
| public |
createRenderCompound(data: *): * Recreates an already spawned compound on the clientside based on server data. |
|
| public |
|
|
| public |
Changes the health of the player by the amount given. |
|
| public |
damageTile(tileID: *, damageAmount: *, player: *, room: *, socket: *): boolean |
|
| public |
deleteObject(type: string, id: *, room: string, socket: *) Deletes one of the three types of gameObjects synced to the server |
|
| public |
Destroy everything in PIXI. |
|
| public |
Run on disconnect to reset all server-based variables and connections |
|
| public |
displayWinner(data: *) Displays the winner panel after a game has concluded. |
|
| public |
distanceBetween(obj1: *, obj2: *): * |
|
| public |
eraseCookie(name: string) Removes the given cookie. |
|
| public |
Runs once a frame, per ROOM. |
|
| public |
generateID(): * Returns a random number between between 10000000 and 99999999, inclusive. |
|
| public |
Sets the value of a cookie. |
|
| public |
getCurrTile(obj: *): string Gets the tile directly underneath any object. |
|
| public |
getField(path: *): * Returns the value given a path to that value. |
|
| public |
getGlobalLocation(obj: *): {"globalY": *, "globalX": *} Gets the coordinates of the tile directly underneath the object. |
|
| public |
|
|
| public |
getTeamColors(room: string): * Returns the team colors object (see client socket.js for more information on the format) |
|
| public |
getTeamNumber(room: string, teamName: string): * Returns the index of the given team within the team array of the given room. |
|
| public |
Returns the serverside ID of the tile at this location. |
|
| public |
hideElement(el: string) Hides a visible element |
|
| public |
incrementAtom(player: *, room: *, atomType: *, quantity: *) |
|
| public |
incrementField(amount: *, path: *) Shorthand to add or concatenate an amount to a field. |
|
| public |
Global initialiation. |
|
| public |
initPlayer(socket: *, room: string, team: string): * Run on every player join. |
|
| public |
Run when the first person joins a new room that has not been initialized yet. |
|
| public |
isFocused(): * If the document is Focused return true otherwise false |
|
| public |
isInBounds(obj: GameObject): * Returns true if the object parameter is within the map boundaries. |
|
| public |
keyboard(keyCode: *): * |
|
| public |
|
|
| public |
mouseDownHandler(e: *) Called on mouse down from app.js |
|
| public |
mouseUpHandler(e: *) Called on mouse up from app.js |
|
| public |
movePlayer(direction: string) Moves the player by changing its velocity. |
|
| public |
Transitions from in-game displays to the main menu. |
|
| public |
requestCreateCompound(blueprint: *, xIn: number, yIn: number, streamID: number): * Creates a Compound by sending a request to the server. |
|
| public |
roomMatchmaker(socket: *, room: string, team: string): * Matchmaking system for public matches. |
|
| public |
Sets the value of a cookie. |
|
| public |
setField(value: *, path: *) Sets a new value for a protected server field. |
|
| public |
Sets the value of inGame |
|
| public |
showElement(el: string) Displays a hidden element |
|
| public |
Call this function to hide loading div and show UI |
|
| public |
|
|
| public |
|
|
| public |
Spawns an atom at the vent at the given row and column. |
|
| public |
splash() TODO |
|
| public |
Starts the game after lobby closes. |
|
| public |
tickCompound(compound: number, room: string, socket: *) Checks compound behavior based on compound type. |
|
| public |
updateAtomList(atomID: string) Updates the list of atoms that the player holds. |
|
| public |
updateCompoundButtons(selectedSlot: number) |
|
| public |
updateLobby(data: *) Run on new player join to sync lobby information |
|
| public |
updateScores(teamSlot: *, increment: *) Updates the team scoreboard on screen. |
|
Static Public
public addExperience(event: string, socket: *, room: string, player: string) source
import {addExperience} from 'atomblast.io/src/server/utils/experience.js'Adds experience to a given player.
public beginConnection() source
import {beginConnection} from 'atomblast.io/src/client/js/socket.js'Attempts to connect to the server. Run on 'start game' press.
- Manages connecting to main server vs. devserver
- Sets up socket listeners
- Loads textures
- Loads pixi
public bindHandler(id: string, handlerMethod: function) source
import {bindHandler} from 'atomblast.io/src/client/js/app.js'Binds handlerMethod to onclick event for element id.
public canCraft(player: *, room: *, blueprint: *): boolean source
import {canCraft} from 'atomblast.io/src/server/utils/atoms.js'Params:
| Name | Type | Attribute | Description |
| player | * | ||
| room | * | ||
| blueprint | * |
public collisionDetect(socket: *, room: string, thisPlayer: *, tempObjects: *) source
import {collisionDetect} from 'atomblast.io/src/server/utils/collision.js'Runs once a frame, checks for collisions between objects and handles them accordingly. Run using
Params:
| Name | Type | Attribute | Description |
| socket | * | socket.io instance. INDEPENDENT OF PLAYER (any valid socket connection can go here!!!!!) |
|
| room | string | The name of the room |
|
| thisPlayer | * | The player object |
|
| tempObjects | * | The list of objects to tick. Should only be the objects rendered on the screen of thisPlayer. Contains compounds, atoms, players |
public createCompound(data: *, room: string, thisPlayer: *, socket: *): * source
import {createCompound} from 'atomblast.io/src/server/utils/compound.js'Checks if a compound can be created, deducts craft material, and returns the new compound. Does NOT add the new compound to the objects array.
Params:
| Name | Type | Attribute | Description |
| data | * | Data sent from the client.
|
|
| room | string | The name of the room |
|
| thisPlayer | * | The current player instance |
|
| socket | * | socket.io instance. INDEPENDENT OF PLAYER (any valid socket connection can go here!!!!!) |
Return:
| * |
public createPlayer(data: *): Player source
import {createPlayer} from 'atomblast.io/src/client/js/pixigame.js'Creates a Player instance once the stage is fully set up and ready.
Params:
| Name | Type | Attribute | Description |
| data | * | Starting values to assign to the player. Generated from server |
public createRenderAtom(data: *): * source
import {createRenderAtom} from 'atomblast.io/src/client/js/obj/create.js'Renders a new atom.
Params:
| Name | Type | Attribute | Description |
| data | * | The server object reference to spawn on the clientside. Must contain:
|
Return:
| * |
public createRenderCompound(data: *): * source
import {createRenderCompound} from 'atomblast.io/src/client/js/obj/create.js'Recreates an already spawned compound on the clientside based on server data.
Params:
| Name | Type | Attribute | Description |
| data | * | Data sent from server:
|
Return:
| * |
public damage(data: *, room: string, socket: *) source
import {damage} from 'atomblast.io/src/server/utils/ondamage.js'Changes the health of the player by the amount given.
Params:
| Name | Type | Attribute | Description |
| data | * | The data sent by the client. Contains:
|
|
| room | string | This room. |
|
| socket | * | This socket. Must include the player id and amount to damage. Amount may be negative (for health boost). |
public damageTile(tileID: *, damageAmount: *, player: *, room: *, socket: *): boolean source
import {damageTile} from 'atomblast.io/src/server/utils/ondamage.js'Params:
| Name | Type | Attribute | Description |
| tileID | * | ||
| damageAmount | * | ||
| player | * | ||
| room | * | ||
| socket | * |
public deleteObject(type: string, id: *, room: string, socket: *) source
import {deleteObject} from 'atomblast.io/src/server/server.js'Deletes one of the three types of gameObjects synced to the server
public destroyPIXI() source
import {destroyPIXI} from 'atomblast.io/src/client/js/pixigame.js'Destroy everything in PIXI. DANGEROUS avoid!
public disconnect() source
import {disconnect} from 'atomblast.io/src/client/js/socket.js'Run on disconnect to reset all server-based variables and connections
public displayWinner(data: *) source
import {displayWinner} from 'atomblast.io/src/client/js/app.js'Displays the winner panel after a game has concluded.
Params:
| Name | Type | Attribute | Description |
| data | * | Server sent data, including name and score of winning team. |
public distanceBetween(obj1: *, obj2: *): * source
import {distanceBetween} from 'atomblast.io/src/client/js/global.js'Params:
| Name | Type | Attribute | Description |
| obj1 | * | ||
| obj2 | * |
Return:
| * |
public eraseCookie(name: string) source
import {eraseCookie} from 'atomblast.io/src/client/js/lib/cookies.js'Removes the given cookie.
Params:
| Name | Type | Attribute | Description |
| name | string | The name of the cookie to erase. |
public frameSync(socket: *, room: string) source
import {frameSync} from 'atomblast.io/src/server/utils/framesync.js'Runs once a frame, per ROOM. Refactored 4/8/19 from player to room.
Params:
| Name | Type | Attribute | Description |
| socket | * | socket.io instance. INDEPENDENT OF PLAYER (any valid socket connection can go here!!!!!) |
|
| room | string | The name of the room |
public generateID(): * source
import {generateID} from 'atomblast.io/src/client/js/global.js'Returns a random number between between 10000000 and 99999999, inclusive. TODO Make every ID guaranteed unique
Return:
| * | random id between 10000000 and 99999999 |
public getCookie(name: string): string source
import {getCookie} from 'atomblast.io/src/client/js/lib/cookies.js'Sets the value of a cookie.
Params:
| Name | Type | Attribute | Description |
| name | string | Name of cookie |
public getCurrTile(obj: *): string source
import {getCurrTile} from 'atomblast.io/src/client/js/global.js'Gets the tile directly underneath any object.
Params:
| Name | Type | Attribute | Description |
| obj | * | Any valid GameObject. |
public getField(path: *): * source
import {getField} from 'atomblast.io/src/server/server.js'Returns the value given a path to that value. Adopted from https://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key
Params:
| Name | Type | Attribute | Description |
| path | * | Array containing all of the subobject identifiers, with the 0th index being the lowest level. Example: rooms.myRoom.players could be accessed through a path value of ['rooms', 'myRoom', 'players'] |
Return:
| * | The value for the given field. |
public getGlobalLocation(obj: *): {"globalY": *, "globalX": *} source
import {getGlobalLocation} from 'atomblast.io/src/client/js/global.js'Gets the coordinates of the tile directly underneath the object.
Params:
| Name | Type | Attribute | Description |
| obj | * | Any valid GameObject. |
Return:
| {"globalY": *, "globalX": *} |
public getTeamColors(room: string): * source
import {getTeamColors} from 'atomblast.io/src/server/utils/serverutils.js'Returns the team colors object (see client socket.js for more information on the format)
Params:
| Name | Type | Attribute | Description |
| room | string | The room name to check |
Return:
| * |
public getTeamNumber(room: string, teamName: string): * source
import {getTeamNumber} from 'atomblast.io/src/server/utils/serverutils.js'Returns the index of the given team within the team array of the given room.
Return:
| * |
public getTileID(globalLocation: *, room: string): boolean source
import {getTileID} from 'atomblast.io/src/server/utils/serverutils.js'Returns the serverside ID of the tile at this location. If the tile is not capturable, then returns false.
Params:
| Name | Type | Attribute | Description |
| globalLocation | * | Contains globalX and globalY. Location on the map |
|
| room | string | The room name to check |
public hideElement(el: string) source
import {hideElement} from 'atomblast.io/src/client/js/app.js'Hides a visible element
Params:
| Name | Type | Attribute | Description |
| el | string | The id of the element to hide |
public incrementAtom(player: *, room: *, atomType: *, quantity: *) source
import {incrementAtom} from 'atomblast.io/src/server/utils/atoms.js'Params:
| Name | Type | Attribute | Description |
| player | * | ||
| room | * | ||
| atomType | * | ||
| quantity | * |
public incrementField(amount: *, path: *) source
import {incrementField} from 'atomblast.io/src/server/server.js'Shorthand to add or concatenate an amount to a field. Best used with numbers or strings.
Params:
| Name | Type | Attribute | Description |
| amount | * | Amount to increment the field by. |
|
| path | * | Path to the field. |
public initGlobal() source
import {initGlobal} from 'atomblast.io/src/server/utils/serverinit.js'Global initialiation. Run once on server start.
public initPlayer(socket: *, room: string, team: string): * source
import {initPlayer} from 'atomblast.io/src/server/utils/serverinit.js'Run on every player join.
Return:
| * |
public initRoom(socket: *, roomName: string) source
import {initRoom} from 'atomblast.io/src/server/utils/serverinit.js'Run when the first person joins a new room that has not been initialized yet.
Params:
| Name | Type | Attribute | Description |
| socket | * | socket.io instance. INDEPENDENT OF PLAYER (any valid socket connection can go here!!!!!) |
|
| roomName | string | The name of the room |
public isFocused(): * source
import {isFocused} from 'atomblast.io/src/client/js/pixigame.js'If the document is Focused return true otherwise false
Return:
| * |
public isInBounds(obj: GameObject): * source
import {isInBounds} from 'atomblast.io/src/client/js/global.js'Returns true if the object parameter is within the map boundaries.
Params:
| Name | Type | Attribute | Description |
| obj | GameObject | The object to test |
Return:
| * | true if the object parameter is within the map boundaries |
public keyboard(keyCode: *): * source
import {keyboard} from 'atomblast.io/src/client/js/lib/keyboard.js'Params:
| Name | Type | Attribute | Description |
| keyCode | * |
Return:
| * |
public mouseDownHandler(e: *) source
import {mouseDownHandler} from 'atomblast.io/src/client/js/pixigame.js'Called on mouse down from app.js
Params:
| Name | Type | Attribute | Description |
| e | * | Click event |
public mouseUpHandler(e: *) source
import {mouseUpHandler} from 'atomblast.io/src/client/js/pixigame.js'Called on mouse up from app.js
Params:
| Name | Type | Attribute | Description |
| e | * | Click event |
public movePlayer(direction: string) source
import {movePlayer} from 'atomblast.io/src/client/js/pixigame.js'Moves the player by changing its velocity.
Params:
| Name | Type | Attribute | Description |
| direction | string | up, down, left, or right |
public quitGame(msg: string, isError: boolean) source
import {quitGame} from 'atomblast.io/src/client/js/app.js'Transitions from in-game displays to the main menu.
public requestCreateCompound(blueprint: *, xIn: number, yIn: number, streamID: number): * source
import {requestCreateCompound} from 'atomblast.io/src/client/js/obj/create.js'Creates a Compound by sending a request to the server.
Return:
| * | true if successful, false if the compound was not requested. |
public roomMatchmaker(socket: *, room: string, team: string): * source
import {roomMatchmaker} from 'atomblast.io/src/server/utils/matchmaker.js'Matchmaking system for public matches. Runs after initial socket.io server connection, but before connecting to a server.
Return:
| * | The new room that has been assigned |
public setCookie(name: string, value: string, days: number) source
import {setCookie} from 'atomblast.io/src/client/js/lib/cookies.js'Sets the value of a cookie.
public setField(value: *, path: *) source
import {setField} from 'atomblast.io/src/server/server.js'Sets a new value for a protected server field. Adopted from https://stackoverflow.com/questions/18936915/dynamically-set-property-of-nested-object
Params:
| Name | Type | Attribute | Description |
| value | * | The value to set |
|
| path | * | Array containing all of the subobject identifiers, with the 0th index being the lowest level. Example: rooms.myRoom.players could be accessed through a path value of ['rooms', 'myRoom', 'players'] |
public setIngame(newValue: boolean) source
import {setIngame} from 'atomblast.io/src/client/js/pixigame.js'Sets the value of inGame
Params:
| Name | Type | Attribute | Description |
| newValue | boolean | Value to set inGame to |
public showElement(el: string) source
import {showElement} from 'atomblast.io/src/client/js/app.js'Displays a hidden element
Params:
| Name | Type | Attribute | Description |
| el | string | The id of the element to show |
public showGameUI() source
import {showGameUI} from 'atomblast.io/src/client/js/pixigame.js'Call this function to hide loading div and show UI
public smartEmit(socket: *, room: string, emitName: string, emitContent: *, to: string) source
import {smartEmit} from 'atomblast.io/src/server/utils/serverutils.js'Params:
| Name | Type | Attribute | Description |
| socket | * | The socket.io instance (independent) |
|
| room | string | Name of the room to emit to. |
|
| emitName | string | Name of the emit event, used to match on the clientside. |
|
| emitContent | * | What content to send over. This can be any object. |
|
| to | string | (OPTIONAL) What ID to send the emit to. Default: sends to all players. |
public spawnAtom(x: number, y: number, type: string, room: string, team: string, verbose: boolean) source
import {spawnAtom} from 'atomblast.io/src/server/utils/atoms.js'Params:
| Name | Type | Attribute | Description |
| x | number | X-position of center |
|
| y | number | Y-position of center |
|
| type | string | Type of atom to spawn |
|
| room | string | The room to spawn in |
|
| team | string | The team that can pick up this atom. Set to 'all' for neutral spawns. |
|
| verbose | boolean | True if this method should output to the console |
public spawnAtomAtVent(row: number, col: number, room: string, team: string, verbose: boolean) source
import {spawnAtomAtVent} from 'atomblast.io/src/server/utils/atoms.js'Spawns an atom at the vent at the given row and column.
public startGame(emit: boolean, teams: *) source
import {startGame} from 'atomblast.io/src/client/js/pixigame.js'Starts the game after lobby closes.
Params:
| Name | Type | Attribute | Description |
| emit | boolean | True if this client should emit the event to the server. |
|
| teams | * | Array of teams on the scoreboard. |
public tickCompound(compound: number, room: string, socket: *) source
import {tickCompound} from 'atomblast.io/src/server/utils/compound.js'Checks compound behavior based on compound type. Runs once a frame.
public updateAtomList(atomID: string) source
import {updateAtomList} from 'atomblast.io/src/client/js/app.js'Updates the list of atoms that the player holds. Only updates the entry for the particular ID given.
Params:
| Name | Type | Attribute | Description |
| atomID | string | The ID of the atom to update. |
public updateCompoundButtons(selectedSlot: number) source
import {updateCompoundButtons} from 'atomblast.io/src/client/js/app.js'Params:
| Name | Type | Attribute | Description |
| selectedSlot | number | The index of the selected slot. 0-3 |
public updateLobby(data: *) source
import {updateLobby} from 'atomblast.io/src/client/js/app.js'Run on new player join to sync lobby information
Params:
| Name | Type | Attribute | Description |
| data | * | The data transferred from server |
public updateScores(teamSlot: *, increment: *) source
import {updateScores} from 'atomblast.io/src/client/js/app.js'Updates the team scoreboard on screen.
Params:
| Name | Type | Attribute | Description |
| teamSlot | * | ||
| increment | * |
