C# Class PunkX.Entity

Main game Entity class updated by World.
Inheritance: Tweener, glue.IPosition
Afficher le fichier Open project: RichardMarks/PunkX

Méthodes publiques

Свойство Type Description
collidable System.Boolean
height int
originX int
originY int
userData Object
visible System.Boolean
width int

Méthodes publiques

Méthode Description
Entity ( float x, float y, Graphic graphic = null, Mask mask = null ) : System

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 array ) : void

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 types, float x, float y ) : Entity

Checks for collision against multiple Entity types.

collideTypesInto ( List types, float x, float y, List array ) : void

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

Method Details

Entity() public méthode

Constructor. Can be usd to place the Entity and assign a graphic and mask.
public Entity ( float x, float y, Graphic graphic = null, Mask mask = null ) : System
x float X position to place the Entity.
y float Y position to place the Entity.
graphic Graphic Graphic to assign to the Entity.
mask Mask Mask to assign to the Entity.
Résultat System

added() public méthode

Override this, called when the Entity is added to a World.
public added ( ) : void
Résultat void

centerOrigin() public méthode

Center's the Entity's origin (half width & height).
public centerOrigin ( ) : void
Résultat void

collide() public méthode

Checks for a collision against an Entity type.
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.
Résultat Entity

collideInto() public méthode

Populates an array with all collided Entities of a type.
public collideInto ( string type, float x, float y, List array ) : void
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.
Résultat void

collidePoint() public méthode

Checks if this Entity overlaps the specified position.
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.
Résultat System.Boolean

collideRect() public méthode

Checks if this Entity overlaps the specified rectangle.
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.
Résultat System.Boolean

collideTypes() public méthode

Checks for collision against multiple Entity types.
public collideTypes ( List types, float x, float y ) : Entity
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.
Résultat Entity

collideTypesInto() public méthode

Populates an array with all collided Entities of multiple types.
public collideTypesInto ( List types, float x, float y, List array ) : void
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.
Résultat void

collideWith() public méthode

Checks if this Entity collides with a specific Entity.
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.
Résultat Entity

distanceFrom() public méthode

Calculates the distance from another 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.
Résultat float

distanceToPoint() public méthode

Calculates the distance from this Entity to the point.
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.
Résultat float

distanceToRect() public méthode

Calculates the distance from this Entity to the rectangle.
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.
Résultat float

removed() public méthode

Override this, called when the Entity is removed from a World.
public removed ( ) : void
Résultat void

render() public méthode

Renders the Entity. If you override this for special behaviour, remember to call super.render() to render the Entity's graphic.
public render ( ) : void
Résultat void

setHitbox() public méthode

Sets the Entity's hitbox properties.
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.
Résultat void

toString() public méthode

Gets the class name as a string.
public toString ( ) : string
Résultat string

update() public méthode

public update ( ) : void
Résultat void

Property Details

collidable public_oe property

If the Entity should respond to collision checks.
public Boolean,System collidable
Résultat System.Boolean

height public_oe property

Height of the Entity's hitbox.
public int height
Résultat int

originX public_oe property

X origin of the Entity's hitbox.
public int originX
Résultat int

originY public_oe property

Y origin of the Entity's hitbox.
public int originY
Résultat int

userData public_oe property

lets the user store additional data in their entities without needing to create inherited classes
public Object userData
Résultat Object

visible public_oe property

If the Entity should render.
public Boolean,System visible
Résultat System.Boolean

width public_oe property

Width of the Entity's hitbox.
public int width
Résultat int