Entity
Direct Subclass:
Example:
const myEntity = new Entity(1, 'player');
Constructor Summary
Public Constructor | ||
public |
constructor(id: Number, kind: String, label: String) Constructor to initialize a new entity |
Member Summary
Public Members | ||
public |
Angle of the entity |
|
public |
[angled description] |
|
public |
Animations for the sprite |
|
public |
Timeout function for blinking |
|
public |
Count down time |
|
public |
Current counter |
|
public |
Critical health |
|
public |
Current animation the sprite should be playing |
|
public |
Set if the entity is dirty |
|
public |
Callback for when the entity is dirty |
|
public |
Whether or not this is fading |
|
public |
Fading time |
|
public |
Grid X position |
|
public |
Grid Y position |
|
public |
Handler for the entity |
|
public |
Has a counter |
|
public |
Hurt sprite name |
|
public |
Entity id |
|
public |
Label for the entity |
|
public |
Name of the entity |
|
public |
Non pathable |
|
public |
Normal sprite name |
|
public |
Path |
|
public |
CAllback function when the entity is ready |
|
public |
Rendering data |
|
public |
Has a shadow |
|
public |
Offset for the shadow on the Y axis |
|
public |
Sprite |
|
public |
Whether or not to flip the sprite on the X axis |
|
public |
Whether or not to flip the sprite on the Y axis |
|
public |
Whether or not the sprite has been loaded |
|
public |
Stunned status |
|
public |
Terror status |
|
public |
Wehther or not this entity is visible |
|
public |
X coordinate |
|
public |
Y coordinate |
Method Summary
Public Methods | ||
public |
Tell this entity to start blinking |
|
public |
Tell this to fade in given the duration |
|
public |
getAnimationByName(name: String): Animation | null Look for an animtions list for this specific animation given it's name |
|
public |
getCoordDistance(toX: Number, toY: Number): Number Get the distance from this entity to the given x,y coordinates |
|
public |
getDistance(entity: Entity): Number Get the distance from this entity to another entity |
|
public |
Returns the name of the sprite |
|
public |
Check if this entity currently has a path |
|
public |
Check whether or not this entity has a shadow |
|
public |
hasWeapon(): Item | Projectile Returns the instance of the weapon this entity has |
|
public |
inAttackRadius(entity: Entity): Boolean Figure out if this entity is within the attack radius of the given entity |
|
public |
inExtraAttackRadius(entity: Entity): Boolean Figure out if this entity is within the extended attack radius of the given entity |
|
public |
isPositionAdjacent(x: Number, y: Number, ignoreDiagonals: Boolean): Boolean Checks to see if the x,y coordinate is adjacent to the entity's current position |
|
public |
Check whether or not this entity is visible |
|
public |
This is important for when the client is on a mobile screen. |
|
public |
When this entity's is dirty (mobile) use this callback |
|
public |
When this entity's sprite is loaded trigger this callback |
|
public |
setAnimation(name: String, speed: Number, count: Number, onEndCount: Number) Set the animation on this entity |
|
public |
setCountdown(count: Number) Set the count for the count down time |
|
public |
setGridPosition(x: Number, y: Number) Set the x,y position of the entity on the tile grid |
|
public |
Set the entity's name |
|
public |
setPosition(x: Number, y: [type]) Set the x,y position for the entity |
|
public |
Set the sprite for this entity |
|
public |
setVisible(visible: Boolean) Set the visibility on this entity |
|
public |
Tell the entity to stop blinking and force it to be visible |
|
public |
Toggle the current visibility of this entity |
Public Constructors
Public Members
Public Methods
public blink(speed: Number) source
Tell this entity to start blinking
Params:
Name | Type | Attribute | Description |
speed | Number | the interval time between blinks |
public fadeIn(time: Number) source
Tell this to fade in given the duration
Params:
Name | Type | Attribute | Description |
time | Number | the amount of time to fade in |
public getAnimationByName(name: String): Animation | null source
Look for an animtions list for this specific animation given it's name
Params:
Name | Type | Attribute | Description |
name | String | the name of the animation |
public getCoordDistance(toX: Number, toY: Number): Number source
Get the distance from this entity to the given x,y coordinates
public getDistance(entity: Entity): Number source
Get the distance from this entity to another entity
Params:
Name | Type | Attribute | Description |
entity | Entity | the entity you want to get the distance to |
public inAttackRadius(entity: Entity): Boolean source
Figure out if this entity is within the attack radius of the given entity
Params:
Name | Type | Attribute | Description |
entity | Entity | Player|Mob|Character|NPC |
Return:
Boolean | returns true if they are within the entity's attack radius, if the entity has no attack radius default to 2 grid cells |
public inExtraAttackRadius(entity: Entity): Boolean source
Figure out if this entity is within the extended attack radius of the given entity
Params:
Name | Type | Attribute | Description |
entity | Entity | Player|Mob|Character|NPC |
Return:
Boolean | returns true if they are within the entity's attack radius, if the entity has no attack radius default to 3 grid cells |
public isPositionAdjacent(x: Number, y: Number, ignoreDiagonals: Boolean): Boolean source
Checks to see if the x,y coordinate is adjacent to the entity's current position
public loadDirty() source
This is important for when the client is on a mobile screen. So the sprite has to be handled differently.
public onDirty(callback: Function) source
When this entity's is dirty (mobile) use this callback
Params:
Name | Type | Attribute | Description |
callback | Function | the function to call when the sprite isDirty |
public onReady(callback: Function) source
When this entity's sprite is loaded trigger this callback
Params:
Name | Type | Attribute | Description |
callback | Function | the function to call when the sprite is loaded |
public setAnimation(name: String, speed: Number, count: Number, onEndCount: Number) source
Set the animation on this entity
public setCountdown(count: Number) source
Set the count for the count down time
Params:
Name | Type | Attribute | Description |
count | Number | sets the counter |
public setGridPosition(x: Number, y: Number) source
Set the x,y position of the entity on the tile grid
public setName(name: String) source
Set the entity's name
Params:
Name | Type | Attribute | Description |
name | String | the name of this entity |
public setPosition(x: Number, y: [type]) source
Set the x,y position for the entity
Params:
Name | Type | Attribute | Description |
x | Number | the x position on the screen |
|
y | [type] | the y position on the screen |
public setSprite(sprite: Sprite) source
Set the sprite for this entity
Params:
Name | Type | Attribute | Description |
sprite | Sprite | the sprite for this entity |