C# 클래스 PunkX.Entity

Main game Entity class updated by World.
상속: Tweener, glue.IPosition
파일 보기 프로젝트 열기: RichardMarks/PunkX

공개 프로퍼티들

프로퍼티 타입 설명
collidable System.Boolean
height int
originX int
originY int
userData Object
visible System.Boolean
width int

공개 메소드들

메소드 설명
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

메소드 상세

Entity() 공개 메소드

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.
리턴 System

added() 공개 메소드

Override this, called when the Entity is added to a World.
public added ( ) : void
리턴 void

centerOrigin() 공개 메소드

Center's the Entity's origin (half width & height).
public centerOrigin ( ) : void
리턴 void

collide() 공개 메소드

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.
리턴 Entity

collideInto() 공개 메소드

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.
리턴 void

collidePoint() 공개 메소드

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.
리턴 System.Boolean

collideRect() 공개 메소드

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.
리턴 System.Boolean

collideTypes() 공개 메소드

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.
리턴 Entity

collideTypesInto() 공개 메소드

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.
리턴 void

collideWith() 공개 메소드

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.
리턴 Entity

distanceFrom() 공개 메소드

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.
리턴 float

distanceToPoint() 공개 메소드

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.
리턴 float

distanceToRect() 공개 메소드

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.
리턴 float

removed() 공개 메소드

Override this, called when the Entity is removed from a World.
public removed ( ) : void
리턴 void

render() 공개 메소드

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

setHitbox() 공개 메소드

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.
리턴 void

toString() 공개 메소드

Gets the class name as a string.
public toString ( ) : string
리턴 string

update() 공개 메소드

public update ( ) : void
리턴 void

프로퍼티 상세

collidable 공개적으로 프로퍼티

If the Entity should respond to collision checks.
public Boolean,System collidable
리턴 System.Boolean

height 공개적으로 프로퍼티

Height of the Entity's hitbox.
public int height
리턴 int

originX 공개적으로 프로퍼티

X origin of the Entity's hitbox.
public int originX
리턴 int

originY 공개적으로 프로퍼티

Y origin of the Entity's hitbox.
public int originY
리턴 int

userData 공개적으로 프로퍼티

lets the user store additional data in their entities without needing to create inherited classes
public Object userData
리턴 Object

visible 공개적으로 프로퍼티

If the Entity should render.
public Boolean,System visible
리턴 System.Boolean

width 공개적으로 프로퍼티

Width of the Entity's hitbox.
public int width
리턴 int