Game
Constructor Summary
| Public Constructor | ||
| public |
constructor(width: number, height: number, extra: Object) The Game class takes in dimensions of the game screen |
|
Member Summary
| Public Members | ||
| public |
PIXI: * |
|
| public |
application: * |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
renderer: * |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
stage: * |
|
| public |
|
|
| public |
|
|
Method Summary
| Public Methods | ||
| public |
addEntities(array: Entity[]) Create & add multiple entities |
|
| public |
Create & add a single entity |
|
| public |
addEntityToStage(entity: *) |
|
| public |
Register a system in the game instance |
|
| public |
addSystems(systems: System[]) Register multiple systems in the game instance |
|
| public |
createEntities(entities: Entity[]) Create an array of entities & add them to the game |
|
| public |
getComponentFromEntity(entityId: string, componentId: string): Component Retrieves a component from a specific entity |
|
| public |
getEntitiesWith(components: string[]): Entity[] Retrieves all entities that have all provided components. |
|
| public |
Retrieve an entity |
|
| public |
Retrive a system in the game |
|
| public |
onStart() The intialization function for the game. |
|
| public |
onUpdate(time: *) The game update that happens every game frame/tick. |
|
| public |
removeEntity(ID: string) Remove entity from game |
|
| public |
start() The game start function. |
|
| public |
stop() |
|
| public |
update(time: *) The game update function. |
|
| Private Methods | ||
| private |
_registerSystem(system: *) |
|
| private |
_rendererSetup(settings: *) |
|
Public Constructors
Public Members
public PIXI: * source
public application: * source
public renderer: * source
public stage: * source
Public Methods
public addEntities(array: Entity[]) source
Create & add multiple entities
Params:
| Name | Type | Attribute | Description |
| array | Entity[] | of entities |
public addEntity(entity: Entity) source
Create & add a single entity
Params:
| Name | Type | Attribute | Description |
| entity | Entity |
public addEntityToStage(entity: *) source
Params:
| Name | Type | Attribute | Description |
| entity | * |
public addSystem(system: System): System source
Register a system in the game instance
Params:
| Name | Type | Attribute | Description |
| system | System |
public addSystems(systems: System[]) source
Register multiple systems in the game instance
Params:
| Name | Type | Attribute | Description |
| systems | System[] |
public createEntities(entities: Entity[]) source
Create an array of entities & add them to the game
Params:
| Name | Type | Attribute | Description |
| entities | Entity[] | An array of entities |
public getComponentFromEntity(entityId: string, componentId: string): Component source
Retrieves a component from a specific entity
public getEntitiesWith(components: string[]): Entity[] source
Retrieves all entities that have all provided components.
Params:
| Name | Type | Attribute | Description |
| components | string[] | A list of component ID's to match against |
public getEntity(id: string): Entity source
Retrieve an entity
Params:
| Name | Type | Attribute | Description |
| id | string | The ID of the entity |
public getSystem(id: string): * source
Retrive a system in the game
Params:
| Name | Type | Attribute | Description |
| id | string | The ID of the system |
Return:
| * |
public onUpdate(time: *) source
The game update that happens every game frame/tick.
Params:
| Name | Type | Attribute | Description |
| time | * |
public removeEntity(ID: string) source
Remove entity from game
Params:
| Name | Type | Attribute | Description |
| ID | string | of entity |
public stop() source
public update(time: *) source
The game update function. Use onUpdate() callback to hook into here
Params:
| Name | Type | Attribute | Description |
| time | * |
Private Methods
private _registerSystem(system: *) source
Params:
| Name | Type | Attribute | Description |
| system | * |
private _rendererSetup(settings: *) source
Params:
| Name | Type | Attribute | Description |
| settings | * |
