import PickCharacter from 'WTF-Adventure/WTF-Adventure/client/controllers/pickcharacter.js'
PickCharacter
Used to load the character and items for the player
Constructor Summary
Public Constructor | ||
public |
constructor(game: Game) Default constructor |
Member Summary
Public Members | ||
public |
|
|
public |
A reference to the entities in the game |
|
public |
Instance of the game |
|
public |
grids: [type] Grids |
|
public |
Instance of the renderer |
|
public |
A reference to other game sprites in the game |
Method Summary
Public Methods | ||
public |
Adds an entity |
|
public |
clearPlayers(exception: Player) Clears the other players from the grid to calculate pathing so they don't collide, then resets the players back into position |
|
public |
create() Create the player in the game |
|
public |
Checks to see if an entity is there |
|
public |
forEachEntity(callback: Function) Apply a callback function to every entity |
|
public |
forEachEntityAround(x: Number, y: Number, radius: Number, callback: Function) Apply a callback function to entities within a position radius |
|
public |
Return a specific entity by index |
|
public |
Returns all available entities |
|
public |
Get a sprite by name |
|
public |
Load the character into the game |
|
public |
registerDuality(entity: Entity) Register position with duality (two things in the same spot) so the entity is moved to a different spot |
|
public |
registerPosition(entity: Entity) Register the position of an entity and add it to the player's grid |
|
public |
removeItem(item: Item) Remove an item from the game |
|
public |
unregisterPosition(entity: Entity) Remove an entity from a position on the grids |
|
public |
update() Updating sprites in the game |
Public Constructors
Public Members
Public Methods
public addEntity(entity: Entity) source
Adds an entity
Params:
Name | Type | Attribute | Description |
entity | Entity | instance of the entity to add |
public clearPlayers(exception: Player) source
Clears the other players from the grid to calculate pathing so they don't collide, then resets the players back into position
Params:
Name | Type | Attribute | Description |
exception | Player | Player to exlude when clearing |
public exists(id: Number): * source
Checks to see if an entity is there
Params:
Name | Type | Attribute | Description |
id | Number | The ID of the entity |
Return:
* | {Entity |
public forEachEntity(callback: Function) source
Apply a callback function to every entity
Params:
Name | Type | Attribute | Description |
callback | Function | the function to apply to every entity |
public forEachEntityAround(x: Number, y: Number, radius: Number, callback: Function) source
Apply a callback function to entities within a position radius
public get(id: Number): Entity source
Return a specific entity by index
Params:
Name | Type | Attribute | Description |
id | Number | returns an entity with that ID |
public getSprite(name: String): Sprite source
Get a sprite by name
Params:
Name | Type | Attribute | Description |
name | String | the name of the sprite |
public registerDuality(entity: Entity) source
Register position with duality (two things in the same spot) so the entity is moved to a different spot
Params:
Name | Type | Attribute | Description |
entity | Entity | An instance of an entity |
public registerPosition(entity: Entity) source
Register the position of an entity and add it to the player's grid
Params:
Name | Type | Attribute | Description |
entity | Entity | An instance of a player, mob, npc or chest |
public removeItem(item: Item) source
Remove an item from the game
Params:
Name | Type | Attribute | Description |
item | Item | An instance of an item |