Property | Type | Description | |
---|---|---|---|
collidable | System.Boolean | ||
height | int | ||
originX | int | ||
originY | int | ||
userData | Object | ||
visible | System.Boolean | ||
width | int |
Method | Description | |
---|---|---|
Entity ( float x, float y, |
Constructor. Can be usd to place the Entity and assign a graphic and mask.
|
|
added ( ) : void |
Override this, called when the Entity is added to a World.
|
|
centerOrigin ( ) : void |
Center's the Entity's origin (half width & height).
|
|
collide ( String type, float x, float y ) : Entity |
Checks for a collision against an Entity type.
|
|
collideInto ( string type, float x, float y, List |
Populates an array with all collided Entities of a type.
|
|
collidePoint ( float x, float y, float pX, float pY ) : System.Boolean |
Checks if this Entity overlaps the specified position.
|
|
collideRect ( float x, float y, float rX, float rY, int rWidth, int rHeight ) : System.Boolean |
Checks if this Entity overlaps the specified rectangle.
|
|
collideTypes ( List |
Checks for collision against multiple Entity types.
|
|
collideTypesInto ( List |
Populates an array with all collided Entities of multiple types.
|
|
collideWith ( Entity e, float x, float y ) : Entity |
Checks if this Entity collides with a specific Entity.
|
|
distanceFrom ( Entity e, System.Boolean useHitboxes = false ) : float |
Calculates the distance from another Entity.
|
|
distanceToPoint ( float px, float py, System.Boolean useHitbox = false ) : float |
Calculates the distance from this Entity to the point.
|
|
distanceToRect ( float rx, float ry, int rwidth, int rheight ) : float |
Calculates the distance from this Entity to the rectangle.
|
|
removed ( ) : void |
Override this, called when the Entity is removed from a World.
|
|
render ( ) : void |
Renders the Entity. If you override this for special behaviour, remember to call super.render() to render the Entity's graphic.
|
|
setHitbox ( int width, int height, int originX, int originY ) : void |
Sets the Entity's hitbox properties.
|
|
toString ( ) : string |
Gets the class name as a string.
|
|
update ( ) : void |
public Entity ( float x, float y, |
||
x | float | X position to place the Entity. |
y | float | Y position to place the Entity. |
graphic | Graphic to assign to the Entity. | |
mask | Mask to assign to the Entity. | |
return | System |
public collide ( String type, float x, float y ) : Entity | ||
type | String | The Entity type to check for. |
x | float | Virtual x position to place this Entity. |
y | float | Virtual y position to place this Entity. |
return | Entity |
public collideInto ( string type, float x, float y, List |
||
type | string | The Entity type to check for. |
x | float | Virtual x position to place this Entity. |
y | float | Virtual y position to place this Entity. |
array | List |
The Array or Vector object to populate. |
return | void |
public collidePoint ( float x, float y, float pX, float pY ) : System.Boolean | ||
x | float | Virtual x position to place this Entity. |
y | float | Virtual y position to place this Entity. |
pX | float | X position. |
pY | float | Y position. |
return | System.Boolean |
public collideRect ( float x, float y, float rX, float rY, int rWidth, int rHeight ) : System.Boolean | ||
x | float | Virtual x position to place this Entity. |
y | float | Virtual y position to place this Entity. |
rX | float | X position of the rectangle. |
rY | float | Y position of the rectangle. |
rWidth | int | Width of the rectangle. |
rHeight | int | Height of the rectangle. |
return | System.Boolean |
public collideTypes ( List |
||
types | List |
An Array or Vector of Entity types to check for. |
x | float | Virtual x position to place this Entity. |
y | float | Virtual y position to place this Entity. |
return | Entity |
public collideTypesInto ( List |
||
types | List |
An array of Entity types to check for. |
x | float | Virtual x position to place this Entity. |
y | float | Virtual y position to place this Entity. |
array | List |
The Array or Vector object to populate. |
return | void |
public collideWith ( Entity e, float x, float y ) : Entity | ||
e | Entity | The Entity to collide against. |
x | float | Virtual x position to place this Entity. |
y | float | Virtual y position to place this Entity. |
return | Entity |
public distanceFrom ( Entity e, System.Boolean useHitboxes = false ) : float | ||
e | Entity | The other Entity. |
useHitboxes | System.Boolean | If hitboxes should be used to determine the distance. If not, the Entities' x/y positions are used. |
return | float |
public distanceToPoint ( float px, float py, System.Boolean useHitbox = false ) : float | ||
px | float | X position. |
py | float | Y position. |
useHitbox | System.Boolean | If hitboxes should be used to determine the distance. If not, the Entities' x/y positions are used. |
return | float |
public distanceToRect ( float rx, float ry, int rwidth, int rheight ) : float | ||
rx | float | X position of the rectangle. |
ry | float | Y position of the rectangle. |
rwidth | int | Width of the rectangle. |
rheight | int | Height of the rectangle. |
return | float |
public setHitbox ( int width, int height, int originX, int originY ) : void | ||
width | int | Width of the hitbox. |
height | int | Height of the hitbox. |
originX | int | X origin of the hitbox. |
originY | int | Y origin of the hitbox. |
return | void |