Package | verlocity.ents |
Class | public class DynamicEntity |
Inheritance | DynamicEntity Entity Object |
Subclasses | DisplayEntity |
Property | Defined By | ||
---|---|---|---|
absX : Number [read-only]
Returns the absolute X position. | DynamicEntity | ||
absY : Number [read-only]
Returns the absolute Y position. | DynamicEntity | ||
baseClass : Object [override] [read-only]
Returns the entity base class. | DynamicEntity | ||
collisionRect : CRectangle [read-only]
Returns the collision rect
| DynamicEntity | ||
defaultHealth : int [read-only]
A getter that returns the default health the entity has. | Entity | ||
_display : Boolean [read-only]
Returns if this entity base contains display functionality (will not Init until spawned). | Entity | ||
_dynamic : Boolean [override] [read-only]
Returns if the entity is dynamic. | DynamicEntity | ||
health : int [read-only]
A getter that returns the current health value of the entity. | Entity | ||
_id : int
Returns the registration ID of the entity. | Entity | ||
initX : Number [read-only]
A getter that returns the initial X position. | DynamicEntity | ||
initY : Number [read-only]
A getter that returns the initial Y position. | DynamicEntity | ||
maxHealth : int
A getter that returns the maximum health this entity can have. | Entity | ||
phys : PhysObject [read-only]
Returns the physics object (short-hand). | DynamicEntity | ||
x : Number
Returns the current calculated x position of this entity
| DynamicEntity | ||
y : Number
Returns the current calculated y position of this entity
| DynamicEntity |
Property | Defined By | ||
---|---|---|---|
bCollisionEnabled : Boolean | DynamicEntity | ||
iBoundPadding : int = 100 | DynamicEntity | ||
iCollisionFlags : int | DynamicEntity | ||
iRemoveOffScreenPadding : int = 100 | DynamicEntity | ||
nInitialX : Number | DynamicEntity | ||
nInitialY : Number | DynamicEntity | ||
nPosX : Number | DynamicEntity | ||
nPosY : Number | DynamicEntity | ||
rectBounds : Rectangle | DynamicEntity | ||
rectCollision : CRectangle | DynamicEntity |
Method | Defined By | ||
---|---|---|---|
_Dispose():void [override]
Cleans the entity's data. | DynamicEntity | ||
_Update():void [override]
Called each engine tick, do not override this. | DynamicEntity | ||
ClearBounds():void
Clears the boundaries of the entity. | DynamicEntity | ||
Construct():void
Called before the entity is spawned to setup the constants of the entity. | Entity | ||
DeInit():void
Called when the entity is deleted. | Entity | ||
EmitSound(sSound:*, nStartVolume:Number = 1, bLoops:Boolean = false, bParent:Boolean = false, bFadeIn:Boolean = false):void
Plays a sound at the location of the entity. | DynamicEntity | ||
EnableCollision(bEnable:Boolean = true):void
Enables/disables calculations for collision. | DynamicEntity | ||
EnablePhysics(bEnable:Boolean = true, bRemovePhysicsObj:Boolean = true):void
Enables/disables calculations for physics. | DynamicEntity | ||
EnableUpdate(bUpdate:Boolean = true):void
Sets if the entity will update each engine tick. | Entity | ||
GetClass():Object
Returns the class of the entity. | Entity | ||
GetMouseRotation():Number
Returns the rotation (0-360) from the relation of the mouse and the entity. | DynamicEntity | ||
GetOwner():Object
Returns the current owner of the entity. | Entity | ||
Returns the physics object
| DynamicEntity | ||
GetPos():Point
Returns the current position as a point
| DynamicEntity | ||
GetType():String
Returns the current string type of the entity. | Entity | ||
HasMoved():Boolean
Returns if the entity has moved (determined by its previous position set)
This is used to optimize collision and physics calculations
| DynamicEntity | ||
Init():void
Called when the entity is first registered/spawned. | Entity | ||
Is(cClass:Class):Boolean
Returns if the entity matches a class. | Entity | ||
IsColliding(ent:DynamicEntity):Boolean
Returns the method of basic collision between other types
| DynamicEntity | ||
IsCollisionEnabled():Boolean
Returns if collision is enabled
| DynamicEntity | ||
IsCollisionFlagOn(iCollisionFlag:int):Boolean
Returns if a collision flag is enabled or not. | DynamicEntity | ||
IsDead():Boolean
Returns if the entity is dead. | Entity | ||
IsHealthZero():Boolean
Returns if the health is zero. | Entity | ||
IsOnBottomBoundary():Boolean | DynamicEntity | ||
IsOnBoundary():Boolean | DynamicEntity | ||
IsOnLeftBoundary():Boolean | DynamicEntity | ||
IsOnRightBoundary():Boolean | DynamicEntity | ||
IsOnScreen():Boolean
Returns if the entity is within the boundaries of the screen. | DynamicEntity | ||
IsOnTopBoundary():Boolean | DynamicEntity | ||
IsOnXBoundary():Boolean | DynamicEntity | ||
IsOnYBoundary():Boolean | DynamicEntity | ||
IsPhysicsEnabled():Boolean
Returns if physics is enabled
| DynamicEntity | ||
IsProtected():Boolean
Returns if the entity is protected. | Entity | ||
IsT(sCheckType:String):Boolean
Returns if the entity is matches a type (lowercase only). | Entity | ||
IsUpdating():Boolean
Returns if the entity is updating. | Entity | ||
OnCollide(ent:*):void
Called when a rectangle collision occured
| DynamicEntity | ||
Remove():void
Marks the entity for removal. | Entity | ||
RemoveAllHealth():void
Removes all health of the entity. | Entity | ||
RemoveOffScreen(bShouldRemove:Boolean = true, iPadding:int = 100):void
Tells the entity to remove itself when its off screen. | DynamicEntity | ||
Reset():void [override]
Resets the entity to its original values. | DynamicEntity | ||
ResetHealth():void
Resets the entity's health to the default health. | Entity | ||
ResetPos():void
Resets the entity to its initial position. | DynamicEntity | ||
SetBounds(rectSetBounds:Rectangle, iInnerPadding:int = 0):void
Sets the screen boundaries of the entity. | DynamicEntity | ||
SetCollisionFlags(iFlags:int):void
Set collision flags. | DynamicEntity | ||
SetCollisionRect(rect:Rectangle, nOffsetX:Number = 0, nOffsetY:Number = 0):void
Sets the collision rect (required for collision)
| DynamicEntity | ||
SetDefaultHealth(setHealth:int = 100):void
Sets the default health of this entity. | Entity | ||
SetHealth(newHealth:int):void
Sets the health value of this entity. | Entity | ||
SetOwner(newOwner:Object):void
Sets the owner of the entity. | Entity | ||
SetPhysicsProperties(nMass:Number, pVelocityDirection:Point, nVelocityMagnitude:Number):void
Sets the physicial properies of this entity
| DynamicEntity | ||
SetPos(nSetPosX:Number, nSetPosY:Number):void
Sets the X and Y position of the entity
| DynamicEntity | ||
SetProtected(bProtected:Boolean = true):void
Protects an entity from being removed by clean up
calls, such as CleanSlate. | Entity | ||
SetType(sSetType:String):void
Sets the string type of the entity. | Entity | ||
StopAllSounds():void
Stops all sounds that are emitting from this entity. | DynamicEntity | ||
TakeDamage(iDamageAmount:int):void
Subtracts the current health. | Entity | ||
Update():void
Called each engine tick. | Entity |
Method | Defined By | ||
---|---|---|---|
CalcXBoundaries(nSetPosX:Number):void
Calculates if a position is beyond the Y boundaries
| DynamicEntity | ||
CalcYBoundaries(nSetPosY:Number):void
Calculates if a position is beyond the Y boundaries
| DynamicEntity | ||
DrawCollisionRect():void | DynamicEntity | ||
OnDeath():void
Called when the entity's health is now 0. | Entity | ||
OnHealthChanged():void
Called when the entity's health has been changed. | Entity | ||
OnTakeDamage():void
Called when the entity took damage via TakeDamage function. | Entity | ||
UpdateCollisionRect(nSetPosX:Number, nSetPosY:Number, nSetScaleX:Number, nSetScaleY:Number, nSetWidth:Number, nSetHeight:Number, nSetOffsetX:Number, nSetOffsetY:Number):void
Update the position/scale of the collision rect
| DynamicEntity |
_dynamic | property |
_dynamic:Boolean
[read-only] [override] Returns if the entity is dynamic.
public function get _dynamic():Boolean
absX | property |
absX:Number
[read-only] Returns the absolute X position.
public function get absX():Number
absY | property |
absY:Number
[read-only] Returns the absolute Y position.
public function get absY():Number
baseClass | property |
baseClass:Object
[read-only] [override] Returns the entity base class.
public function get baseClass():Object
bCollisionEnabled | property |
protected var bCollisionEnabled:Boolean
collisionRect | property |
collisionRect:CRectangle
[read-only] Returns the collision rect
public function get collisionRect():CRectangle
iBoundPadding | property |
protected var iBoundPadding:int = 100
iCollisionFlags | property |
protected var iCollisionFlags:int
initX | property |
initX:Number
[read-only] A getter that returns the initial X position.
public function get initX():Number
initY | property |
initY:Number
[read-only] A getter that returns the initial Y position.
public function get initY():Number
iRemoveOffScreenPadding | property |
protected var iRemoveOffScreenPadding:int = 100
nInitialX | property |
protected var nInitialX:Number
nInitialY | property |
protected var nInitialY:Number
nPosX | property |
protected var nPosX:Number
nPosY | property |
protected var nPosY:Number
phys | property |
phys:PhysObject
[read-only] Returns the physics object (short-hand). If the physics object doesn't exist, it'll create a new one.
public function get phys():PhysObject
rectBounds | property |
protected var rectBounds:Rectangle
rectCollision | property |
protected var rectCollision:CRectangle
x | property |
x:Number
Returns the current calculated x position of this entity
public function get x():Number
public function set x(value:Number):void
y | property |
y:Number
Returns the current calculated y position of this entity
public function get y():Number
public function set y(value:Number):void
_Dispose | () | method |
override public function _Dispose():void
Cleans the entity's data. DO NOT CALL MANUALLY - THIS IS HANDLED BY verEnts!
_Update | () | method |
override public function _Update():void
Called each engine tick, do not override this. DO NOT CALL MANUALLY - THIS IS HANDLED BY verEnts!
CalcXBoundaries | () | method |
protected function CalcXBoundaries(nSetPosX:Number):void
Calculates if a position is beyond the Y boundaries
Parameters
nSetPosX:Number |
CalcYBoundaries | () | method |
protected function CalcYBoundaries(nSetPosY:Number):void
Calculates if a position is beyond the Y boundaries
Parameters
nSetPosY:Number |
ClearBounds | () | method |
public function ClearBounds():void
Clears the boundaries of the entity.
DrawCollisionRect | () | method |
protected function DrawCollisionRect():void
EmitSound | () | method |
public function EmitSound(sSound:*, nStartVolume:Number = 1, bLoops:Boolean = false, bParent:Boolean = false, bFadeIn:Boolean = false):void
Plays a sound at the location of the entity.
Parameters
sSound:* — The sound to play.
| |
nStartVolume:Number (default = 1 ) — The starting volume of the sound.
| |
bLoops:Boolean (default = false ) — Should the sound loop or not?
| |
bParent:Boolean (default = false ) — Set this to true if you want the sound to follow the entity's position.
| |
bFadeIn:Boolean (default = false )
|
EnableCollision | () | method |
public function EnableCollision(bEnable:Boolean = true):void
Enables/disables calculations for collision. If no collision flags are set, by default, the CO_BASIC collision flag is set.
Parameters
bEnable:Boolean (default = true ) — Enables/disables collision
|
EnablePhysics | () | method |
public function EnablePhysics(bEnable:Boolean = true, bRemovePhysicsObj:Boolean = true):void
Enables/disables calculations for physics.
Parameters
bEnable:Boolean (default = true ) — Enables/disables physics
| |
bRemovePhysicsObj:Boolean (default = true ) — Remove the physics object on disable?
|
GetMouseRotation | () | method |
public function GetMouseRotation():Number
Returns the rotation (0-360) from the relation of the mouse and the entity.
ReturnsNumber —
|
GetPhysicsObject | () | method |
GetPos | () | method |
public function GetPos():Point
Returns the current position as a point
ReturnsPoint —
|
HasMoved | () | method |
public function HasMoved():Boolean
Returns if the entity has moved (determined by its previous position set) This is used to optimize collision and physics calculations
ReturnsBoolean —
|
IsColliding | () | method |
public function IsColliding(ent:DynamicEntity):Boolean
Returns the method of basic collision between other types
Parameters
ent:DynamicEntity |
Boolean —
|
IsCollisionEnabled | () | method |
public function IsCollisionEnabled():Boolean
Returns if collision is enabled
ReturnsBoolean |
IsCollisionFlagOn | () | method |
public function IsCollisionFlagOn(iCollisionFlag:int):Boolean
Returns if a collision flag is enabled or not.
Parameters
iCollisionFlag:int — The collision flag to test (found in Verlocity.collision.CO_
|
Boolean |
IsOnBottomBoundary | () | method |
public function IsOnBottomBoundary():Boolean
ReturnsBoolean |
IsOnBoundary | () | method |
public function IsOnBoundary():Boolean
ReturnsBoolean |
IsOnLeftBoundary | () | method |
public function IsOnLeftBoundary():Boolean
ReturnsBoolean |
IsOnRightBoundary | () | method |
public function IsOnRightBoundary():Boolean
ReturnsBoolean |
IsOnScreen | () | method |
public function IsOnScreen():Boolean
Returns if the entity is within the boundaries of the screen.
ReturnsBoolean |
IsOnTopBoundary | () | method |
public function IsOnTopBoundary():Boolean
ReturnsBoolean |
IsOnXBoundary | () | method |
public function IsOnXBoundary():Boolean
ReturnsBoolean |
IsOnYBoundary | () | method |
public function IsOnYBoundary():Boolean
ReturnsBoolean |
IsPhysicsEnabled | () | method |
public function IsPhysicsEnabled():Boolean
Returns if physics is enabled
ReturnsBoolean |
OnCollide | () | method |
public function OnCollide(ent:*):void
Called when a rectangle collision occured
Parameters
ent:* — The entity that collided
|
RemoveOffScreen | () | method |
public function RemoveOffScreen(bShouldRemove:Boolean = true, iPadding:int = 100):void
Tells the entity to remove itself when its off screen. Useful for bullets.
Parameters
bShouldRemove:Boolean (default = true ) — Should the entity be removed off screen?
| |
iPadding:int (default = 100 ) — Padding to use when removing off screen
|
Reset | () | method |
override public function Reset():void
Resets the entity to its original values.
ResetPos | () | method |
public function ResetPos():void
Resets the entity to its initial position.
SetBounds | () | method |
public function SetBounds(rectSetBounds:Rectangle, iInnerPadding:int = 0):void
Sets the screen boundaries of the entity. This limits the movement of the entity to these boundaries.
Parameters
rectSetBounds:Rectangle — The rectangle boundary
| |
iInnerPadding:int (default = 0 ) — The inner padding of the bounds
|
SetCollisionFlags | () | method |
public function SetCollisionFlags(iFlags:int):void
Set collision flags. For multiples, seperate each flag with | These can be found in Verlocity.collision.CO_
Parameters
iFlags:int — The collision flags to test (found in Verlocity.collision.CO_
|
SetCollisionRect | () | method |
public function SetCollisionRect(rect:Rectangle, nOffsetX:Number = 0, nOffsetY:Number = 0):void
Sets the collision rect (required for collision)
Parameters
rect:Rectangle — The rectangle to use for collision
| |
nOffsetX:Number (default = 0 ) — The offset from the center point of the entity
| |
nOffsetY:Number (default = 0 ) — The offset from the center point of the entity
|
SetPhysicsProperties | () | method |
public function SetPhysicsProperties(nMass:Number, pVelocityDirection:Point, nVelocityMagnitude:Number):void
Sets the physicial properies of this entity
Parameters
nMass:Number — The calculated mass of the entity
| |
pVelocityDirection:Point — The initial velocity direction (normalized)
| |
nVelocityMagnitude:Number — The initial velocity magnitude
|
SetPos | () | method |
public function SetPos(nSetPosX:Number, nSetPosY:Number):void
Sets the X and Y position of the entity
Parameters
nSetPosX:Number — The X position to set the entity to.
| |
nSetPosY:Number — The Y position to set the entity to.
|
StopAllSounds | () | method |
public function StopAllSounds():void
Stops all sounds that are emitting from this entity.
UpdateCollisionRect | () | method |
protected function UpdateCollisionRect(nSetPosX:Number, nSetPosY:Number, nSetScaleX:Number, nSetScaleY:Number, nSetWidth:Number, nSetHeight:Number, nSetOffsetX:Number, nSetOffsetY:Number):void
Update the position/scale of the collision rect
Parameters
nSetPosX:Number (default = NaN )
| |
nSetPosY:Number (default = NaN )
| |
nSetScaleX:Number (default = NaN )
| |
nSetScaleY:Number (default = NaN )
| |
nSetWidth:Number (default = NaN )
| |
nSetHeight:Number (default = NaN )
| |
nSetOffsetX:Number (default = NaN )
| |
nSetOffsetY:Number (default = NaN )
|