Members
-
activateCallback :function
-
Function called on activate.
- do not use this for predefined entity classes, override activate instead- Inherited From:
- Source:
-
activateContext :Object
-
Context to execute activate callback function in.
- do not use this for predefined entity classes, override activate instead- Inherited From:
- Source:
-
activated :Boolean
-
Whether entity's activate has been triggered,
- set to true to have an entity activate on init- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> added :Boolean
-
Whether entity has been added to game world.
- Inherited From:
- Default Value:
- false
- Source:
-
align :Vector2
-
Alignment relative to screen size in values from 0 to 1.
- Inherited From:
- Default Value:
- 0% (top left)
- Source:
-
alpha
-
Overlays should be slightly transparent.
- Inherited From:
- Source:
-
alwaysToggleActivate :Boolean
-
Whether entity's activate should override deactivate.
- Inherited From:
- Default Value:
- false
- Source:
-
angle :Number
-
Angle of rotation in radians.
- Inherited From:
- Default Value:
- 0
- Source:
-
animationType :Number
-
Type of animation from ig.EntityExtended#animationTypes.
- used when creating animations from ig.EntityExtended#animSettings- Inherited From:
- Default Value:
- 0
- Source:
-
animationTypes :Array
-
Types of animation.
- used when creating animations from ig.EntityExtended#animSettings- Inherited From:
- Default Value:
- null
- Source:
-
animFrameTime :Number
-
Default frame time in seconds for animations when not defined in ig.EntityExtended#animSettings.
- used when creating animations from ig.EntityExtended#animSettings- Inherited From:
- Default Value:
- 1
- Source:
-
animInit :String
-
Name of animation to play when entity is ready and after spawned.
- Inherited From:
- Source:
-
animSequenceCount :Number
-
Default sequence frame count for animations when not defined in ig.EntityExtended#animSettings.
- used when creating animations from ig.EntityExtended#animSettings- Inherited From:
- Default Value:
- 1
- Source:
-
animSettings :Object
-
Animation settings used to automatically create and add animations on initialization.
- use this instead of hardcoding animations into ig.EntityExtended#init for better inheritance!- Inherited From:
- Default Value:
- null
- Source:
// previous method of adding animations // this would likely be hardcoded into the init method this.addAnim( 'idleX', 0.25, [0,1] ); // new (and improved?) method of adding animations // which would be defined in the class properties // properties match the parameters passed to ig.AnimationExtended#init animSettings: { // note here the directional animation name // animations in Impact++ are directional and based on flip and facing // so if an entity can flip X // you should have animations for X // i.e. "idleX" // but if an entity can flip X and Y // you should have animations for both X and Y // i.e. "idleX" and "idleY" // if an entity cannot flip X and Y // you should have animations for Up, Down, Left, and Right // i.e. "idleUp", "idleDown", "idleLeft", "idleRight" idleX: { // sequence frames 0 and 1 sequence: [0,1], // quarter second per frame frameTime: 0.25, // play only once once: true, // do not play immediately stop: true // play animation in reverse reverse: true } } // then to easily change the sequence in a descendant class // while retaining the original properties animSettings: { idleX: { sequence: [3,4,5,6] } }
-
animSheetHeight :Number
-
Tile height of dynamic animation sheet. IMPORTANT: use this for dynamically / run-time created entity types, not classes.
- Inherited From:
- Default Value:
- 0
- Source:
-
animSheetPath :String
-
Path to dynamic animation sheet.
- created on init
- automatically prepends shared base media directory from ig.CONFIG.PATH_TO_MEDIA IMPORTANT: use this for dynamically / run-time created entity types, not classes.- Inherited From:
- Source:
-
animSheetWidth :Number
-
Tile width of dynamic animation sheet. IMPORTANT: use this for dynamically / run-time created entity types, not classes.
- Inherited From:
- Default Value:
- 0
- Source:
-
animTileOffset :Number
-
Default tile offset, within animation sheet, to start animation when not defined in ig.EntityExtended#animSettings.
- used when creating animations from ig.EntityExtended#animSettings- Inherited From:
- Default Value:
- 0
- Source:
-
autoDeactivate :Boolean
-
Automatically deactivates ui element during cleanup.
- Inherited From:
- Default Value:
- true
- Source:
-
b :Number
-
Fill blue value from 0 to 1.
- overriden by all other fill properties- Inherited From:
- Source:
-
bounciness :Number
-
How bouncy entity is in collisions, between 0 and 1.
- Inherited From:
- Source:
- See:
-
canDieInstantly :Boolean
-
Whether entity can skip death animation if it dies while off screen.
- Inherited From:
- Default Value:
- true
- Source:
-
canFlipX
-
UI elements don't need to flip like entities.
- Inherited From:
- Source:
-
canFlipY
-
UI elements don't need to flip like entities.
- Inherited From:
- Source:
-
<readonly> changed :Boolean
-
Whether entity has changed since last update.
- Inherited From:
- Default Value:
- false
- Source:
-
checkAgainst :Bitflag|Number
-
Entities to check against, expanded for more flexibility and specificity. IMPORTANT: for an entity to avoid being ignored in checks, it must either collide, checkAgainst, or have a type!
- Inherited From:
- Default Value:
- none
- Source:
- See:
-
<readonly> checking :Boolean
-
Whether entity is checking against another entity matching ig.Entity#checkAgainst flag.
- Inherited From:
- Default Value:
- false
- Source:
-
climbable :Boolean
-
Whether entity is climbable.
- Inherited From:
- Default Value:
- false
- Source:
-
climbableStairs :Boolean
-
Whether entity is climbable as stairs. IMPORTANT: has no effect unless ig.EntityExtended#climbable is true.
- Inherited From:
- Default Value:
- false
- Source:
-
collides :Bitflag|Number
-
How entity should collide with other entities.
- this does not affect whether entity collides with collision map, only how it collides with other entities IMPORTANT: for an entity to avoid being ignored in checks, it must either collide, checkAgainst, or have a type!- Inherited From:
- Default Value:
- never
- Source:
- See:
-
- ig.Entity
-
collidesChanges :Boolean
-
Whether an entity may change its ig.EntityExtended#collides property during gameplay. IMPORTANT: this forces an entity to be included in collision checks, even if it does not collide, checkAgainst, or have a type
- Inherited From:
- Default Value:
- false
- Source:
-
collidingWithEntitiesBelow :Boolean
-
Whether entity is colliding with one or more entities below.
- Inherited From:
- Default Value:
- false
- Source:
-
collidingWithMap :Boolean
-
Whether entity is colliding with a wall, floor, ceiling, etc in collision map.
- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> collisionMapResult :Object
-
Entity's result from colliding with ig.GameExtended#collisionMap.
- created on init- Inherited From:
- Source:
-
controllable :Boolean
-
Whether entity has control of itself and can move. IMPORTANT: uncontrollable entities update but do not move or change!
- Inherited From:
- Default Value:
- true
- Source:
-
cornerRadius :Number
-
Corner radius, i.e. roundness of box corners
- Inherited From:
- Default Value:
- 0
- Source:
-
cornerRadiusAsPct :Boolean
-
Whether to treat corner radius as a percentage of size between 0 and 1.
- Inherited From:
- Default Value:
- false
- Source:
-
cover :Boolean
-
Whether radial gradient should cover, i.e. use max dimension, or contain, i.e. use min dimension.
- does nothing to linear gradients- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> currentAnim :ig.AnimationExtended
-
Currently displaying animation.
- defers to ig.EntityExtended#overridingAnim- Inherited From:
- Default Value:
- null
- Source:
-
deactivateCallback :function
-
Function called on deactivate.
- do not use this for predefined entity classes, override activate instead- Inherited From:
- Source:
-
deactivateContext :Object
-
Context to execute deactivate callback function in.
- do not use this for predefined entity classes, override activate instead- Inherited From:
- Source:
-
<readonly> dieing :Boolean
-
Whether entity is in the process of dieing.
- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> dieingSilently :Boolean
-
Whether entity is in the process of dieing without effects or animation.
- Inherited From:
- Default Value:
- false
- Source:
-
diffuse :Number
-
How much light is blocked when ig.EntityExtended#opaque.
- Inherited From:
- Source:
-
facing :Vector2|Object
-
Facing direction of entity based on velocity and look at.
- Inherited From:
- Default Value:
- right
- Source:
-
fill :ig.ImageDrawing
-
Overlay fill.
- created on init- Inherited From:
- Source:
-
fillColors :Array
-
List of string fill colors for gradient.
- overrides r,g,b properties when present IMPORTANT: this property determines whether to fill as a gradient or not.- Inherited From:
- Default Value:
- null
- Source:
-
filled :Boolean
-
Whether fill overlay with a color, pattern, etc.
- Inherited From:
- Default Value:
- true
- Source:
-
fillStyle :String
-
Fill style (color, pattern, etc).
- overrides all other fill properties when present- Inherited From:
- Source:
-
fixed
-
UI elements are usually fixed in the screen.
- Inherited From:
- Default Value:
- true
- Source:
-
flip :Boolean
-
Whether entity is flipped. IMPORTANT: flip is now an object with x and y boolean values!
- Inherited From:
- Source:
-
friction :Vector2|Object
-
Friction of entity
- Inherited From:
- Source:
- See:
-
frozen
-
UI elements generally do not need to be updated.
- Inherited From:
- Default Value:
- true
- Source:
-
g :Number
-
Fill green value from 0 to 1.
- overriden by all other fill properties- Inherited From:
- Source:
-
gradientHorizontal :Boolean
-
Whether linear gradient should be horizontal or vertical.
- does nothing to radial gradients- Inherited From:
- Default Value:
- false
- Source:
-
gradientRadial :Boolean
-
Whether to fill gradient as a radial or linear.
- Inherited From:
- Default Value:
- false
- Source:
-
gravityFactor :Number
-
Percent of gravity to apply, between 0 and 1.
- Inherited From:
- Source:
- See:
-
grounded :Boolean
-
Whether entity is grounded.
- Inherited From:
- Source:
- See:
-
group :Bitflag|Number
-
Group of entities to avoid checking against and colliding with. Tip: as the group property is a bitflag, it can be any combination of groups!
- Inherited From:
- Default Value:
- none
- Source:
- See:
-
<readonly> hasGravity :Boolean
-
Whether entity has gravity.
- set automatically during update- Inherited From:
- Source:
-
health :Number
-
Health statistic.
- someone once asked me how I died, so I told them that my health reached 0- Inherited From:
- Source:
-
healthMax :Number
-
Max health statistic.
- Inherited From:
- Source:
-
<readonly> hidden :Boolean
-
Whether entity is hidden and cannot be seen by other entities. Set via ig.EntityExtended#setHidden.
- Inherited From:
- Default Value:
- false
- Source:
-
highPerformance :Boolean
-
Whether entity is high performance, i.e. skips a lot of checks and adds/removals to increase speed at the loss of flexibility and functionality. IMPORTANT: high performance entities don't check, don't collide, and are not interactive!
- Inherited From:
- Default Value:
- false
- Source:
-
hollow :Boolean
-
Whether entity only casts shadows from edges when ig.EntityExtended#opaque.
- Inherited From:
- Default Value:
- true
- Source:
-
ignoreSystemScale
-
Overlays should match system scale, not UI scale.
- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> intersecting :Boolean
-
Whether entity is intersecting another entity.
- Inherited From:
- Default Value:
- false
- Source:
-
invulnerable :Boolean
-
Whether entity blocks all incoming damage.
- Inherited From:
- Default Value:
- false
- Source:
-
layerName
-
Overlay should be on ui layer so it is not paused.
- Source:
-
linkAlign :Vector2
-
Alignment in percent used to offset the element based on ig.UIElement#linkedTo's size.
- Inherited From:
- Default Value:
- 0%
- Source:
-
linkAlignInside :Boolean
-
Flips ig.UIElement#linkAlign so that coordinates are relative to inside of linkedTo element
- Inherited From:
- Default Value:
- false
- Source:
-
linkedTo :ig.EntityExtended
-
Another entity that this entity is linked to.
- Inherited From:
- Default Value:
- null
- Source:
-
<readonly> managed :Boolean
-
Whether entity is currently being managed by ig.GameExtended#playerManager.
- Inherited From:
- Default Value:
- false
- Source:
-
margin :Vector2
-
Pseudo margins that won't actually keep other elements away.
- this is used to offset the element based on the pivot- Inherited From:
- Default Value:
- 0%
- Source:
-
marginAsPct :Boolean
-
Whether to treat margin as a percentage of screen size.
- Inherited From:
- Default Value:
- true
- Source:
-
marginAsPctSmallest :Boolean
-
Whether to get margin percentages from smallest dimension in screen size.
- Inherited From:
- Default Value:
- ig.CONFIG.UI.MARGIN_AS_PCT_SMALLEST
- Source:
-
marginScaleless :Boolean
-
Whether margins should be calculated consistently at all scales. Ex: a button should be 15px away from the edge no matter the scale.
- Inherited From:
- Default Value:
- ig.CONFIG.UI.MARGIN_SCALELESS
- Source:
-
maxVel :Vector2|Object
-
Max velocity of entity
- Inherited From:
- Source:
- See:
-
message :ig.UIText
-
Text to show with overlay.
- created on init
- requires ig.UIOverlay#textSettings- Inherited From:
- Default Value:
- null
- Source:
-
messageEntity :ig.EntityExtended
-
Message entity class.
- Inherited From:
- Source:
-
minBounceVelocity :Number
-
Minimum velocity to bounce.
- Inherited From:
- Source:
- See:
-
<readonly> movedTo :Boolean
-
Whether entity has moved to currently moving to entity.
- Inherited From:
- Default Value:
- true
- Source:
-
<readonly> moving :Boolean
-
Whether entity is moving.
- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> movingTo :ig.EntityExtended|Vector2|Object
-
Whether entity is moving to another entity.
- Inherited From:
- Default Value:
- null
- Source:
-
<readonly> movingToOnce :Boolean
-
Whether entity should move to another entity and stop moving.
- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> movingToTweening :Boolean
-
Whether entity is tweening to another entity. IMPORTANT: this is automatically disabled with dynamic entities!
- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> movingToTweenPct :Number
-
Percent progress of tweening to another entity.
- Inherited From:
- Source:
-
<readonly> movingX :Boolean
-
Whether entity is moving horizontally.
- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> movingY :Boolean
-
Whether entity is moving vertically.
- Inherited From:
- Default Value:
- false
- Source:
-
needsRebuild :Boolean
-
Whether entity needs to be rebuilt on next refresh. IMPORTANT: it is usually a bad idea to set this to false initially!
- Inherited From:
- Default Value:
- true
- Source:
-
needsVertices :Boolean
-
Whether to calculate vertices on change.
- Inherited From:
- Source:
- See:
-
offset :Vector2|Object
-
Offset of entity, reflected on both sides.
- Inherited From:
- Source:
- See:
-
onAdded :ig.Signal
-
Signal dispatched when entity added to game.
- created on init.- Inherited From:
- Source:
-
oneWay :Boolean
-
Whether entity is one way
- Inherited From:
- Default Value:
- false
- Source:
-
oneWayFacing :Vector2
-
Direction from which entity will collide with another entity.
- Inherited From:
- Default Value:
- null
- Source:
// direction should be a 2d vector with a length of 1 // i.e. this is invalid entity.oneWayFacing = { x: 0, y: 0 }; // while either of the following is okay entity.oneWayFacing = { x: 1, y: 0 }; entity.oneWayFacing = ig.utilsvector2.vector( 1, 0 ); // to block from the left entity.oneWayFacing = { x: -1, y: 0 }; // to block from the right entity.oneWayFacing = { x: 1, y: 0 }; // to block from the top entity.oneWayFacing = { x: 0, y: -1 }; // to block from the bottom entity.oneWayFacing = { x: 0, y: 1 };
-
onMovedTo :ig.Signal
-
Signal dispatched when entity completes moving to another entity.
- created on init.- Inherited From:
- Source:
-
onRefreshed :ig.Signal
-
Signal dispatched when entity is refreshed.
- created on init.- Inherited From:
- Source:
-
onRemoved :ig.Signal
-
Signal dispatched when entity removed from game.
- created on init.- Inherited From:
- Source:
-
opaque :Boolean
-
Whether entity casts a shadow from lights.
- Inherited From:
- Source:
-
opaqueFromVertices :Boolean
-
Whether opaque vertices should use vertices when present. IMPORTANT: when true, this overrides ig.EntityExtended#initOpaqueVertices, and ig.EntityExtended#getOpaqueVertices.
- Inherited From:
- Source:
- See:
-
opaqueOffset :Object
-
Size to offset from entity bounds for casting shadows when ig.EntityExtended#opaque. Tip: to set opaque offsets per animation, use ig.AnimationExtended#opaqueOffset
- Inherited From:
- Source:
- See:
// by default, shadow casting uses // entity's opaque offsets entity.opaqueOffset = { left: 0, right: 0, top: 0, bottom: 0 }; // unless the entity's current animation // has its own opaque offsets entity.currentAnim.opaqueOffset = { left: 0, right: 0, top: 0, bottom: 0 }; // opaque offsets can also be done per tile entity.currentAnim.opaqueOffset = { tiles: { 1: { left: 0, right: 0, top: 0, bottom: 0 }, 2: {...} } };
-
opaqueVertices :Array
-
List of vertices in world space for shadow casting.
- recalculated when casting shadows by ig.EntityExtended#getOpaqueVertices- Inherited From:
- Source:
-
<readonly> overridingAnim :ig.AnimationExtended
-
Currently overriding animation.
- if present, this displays instead of ig.EntityExtended#currentAnim- Inherited From:
- Default Value:
- null
- Source:
-
<readonly> paused :Boolean
-
Whether entity is paused.
- Inherited From:
- Default Value:
- false
- Source:
-
performance :String
-
How entity should perform during update.
- static will only update animation
- movable can move but does not collide with collision map
- dynamic does full update, including movement and collision map checks IMPORTANT: this directly correlates to the complexity of entity's update and whether it collides with collision map.- Inherited From:
- Default Value:
- static
- Source:
-
persistent :Boolean
-
Whether entity should remain across levels. Tip: an entity will only be moved from one level to another if an entity is found with a matching name! IMPORTANT: the game will keep the first of each uniquely named persistent entity it encounters and merge the editor position and settings of any others with the same name as it encounters them.
- Inherited From:
- Default Value:
- false
- Source:
-
pixelPerfect :Boolean
-
Whether overlay should be filled pixel perfectly. IMPORTANT: when true, only the r, g, b, and alpha properties are used to fill!
- Inherited From:
- Source:
-
pos :Vector2|Object
-
Base position.
- Inherited From:
- Source:
-
posAsPct :Boolean
-
Whether to get position as a percentage of screen size.
- Inherited From:
- Source:
-
<readonly> posDraw :Vector2|Object
-
Drawn position.
- Inherited From:
- Source:
-
posPct :Vector2
-
Percentage of screen size to be converted to position in values from 0 to 1. IMPORTANT: this overrides pos property when ig.UIElement#posAsPct is true.
- Inherited From:
- Default Value:
- 0%
- Source:
-
r :Number
-
Fill red value from 0 to 1.
- overriden by all other fill properties- Inherited From:
- Source:
-
rangeInteractableX :Number
-
Horizontal range at which this entity can be interacted with.
- a range of 0 is considered infinite
- abilities compare this to their own range and use the higher of the two IMPORTANT: only relevant if entity type includes ig.EntityExtended.TYPE.INTERACTIVE.- Inherited From:
- Default Value:
- 0
- Source:
-
rangeInteractableY :Number
-
Vertical range at which this entity can be interacted with.
- a range of 0 is considered infinite
- abilities compare this to their own range and use the higher of the two IMPORTANT: only relevant if entity type includes ig.EntityExtended.TYPE.INTERACTIVE.- Inherited From:
- Default Value:
- 0
- Source:
-
resetState :Object
-
Last recorded state taken during ig.EntityExtended#recordResetState.
- automatically updated first time entity added to game world
- reset state records only a limited set of properties
- this can be useful for checkpoints, respawning, etc- Inherited From:
- Source:
-
scale :Number
-
Scale that overrides system scale when ig.UIElement#ignoreSystemScale is true.
- Inherited From:
- Default Value:
- ig.CONFIG.UI.SCALE
- Source:
-
scaleMax
-
Overlays should have entity max/min scaling.
- Inherited From:
- Default Value:
- ig.CONFIG.ENTITY.SCALE_MAX
- Source:
-
scaleMin
-
Overlays should have entity max/min scaling.
- Inherited From:
- Default Value:
- ig.CONFIG.ENTITY.SCALE_MIN
- Source:
-
<readonly> scaleMod :Number
-
Modifier for when ig.EntityExtended#scale != ig.system.scale.
- Inherited From:
- Default Value:
- 1
- Source:
-
scaleOfSystemScale :Number
-
Overlay should match entity scale of system scale.
- Inherited From:
- Default Value:
- ig.CONFIG.ENTITY.SCALE_OF_SYSTEM_SCALE
- Source:
-
size :Vector2|Object
-
Size of entity
- Inherited From:
- Source:
- See:
-
sizeAsPct :Boolean
-
Whether to treat size as a percentage of screen size in values from 0 to 1.
- Inherited From:
- Default Value:
- true
- Source:
-
<readonly> sizeDraw :Vector2|Object
-
Drawn size of entity, including size, offsets, etc.
- Inherited From:
- Source:
-
sizePct
-
Percentage of screen size to be converted to ig.EntityExtended#size in values from 0 to 1.
- Inherited From:
- Default Value:
- 100%
- Source:
-
slope :Object
-
Whether entity is on a slope, and if so, slope properties.
- Inherited From:
- Source:
-
slopeSpeedMod :Number
-
Speed multiplier on slopes
- Inherited From:
- Source:
- See:
-
slopeStanding :Vector2
-
Slope angle range that entity can stand on.
- Inherited From:
- Source:
- See:
-
slopeSticking :Boolean
-
Whether entity should stick to slopes instead of sliding down.
- Inherited From:
- Source:
- See:
-
standing :Boolean
-
Whether entity is standing.
- Inherited From:
- Source:
- See:
-
targetable :Boolean
-
Whether entity can be targeted by an intersection search. Tip: for interactive entities, set this to true and add the ig.EntityExtended.TYPE.INTERACTIVE flag to its type.
- Inherited From:
- Default Value:
- false
- Source:
-
textMoveToSettings :Object
-
Settings object for message move to when overlay is moving to.
- Inherited From:
- Source:
-
textSettings
-
Let player know game is paused.
- Source:
-
textured :Boolean
-
Whether animations should be automatically textured across entity when added to entity.
- textures can be animated, but be careful about adding high amounts of frames Tip: this is best applied to resizable entities.- Inherited From:
- Default Value:
- false
- Source:
-
<readonly> totalMarginX :Number
-
Total horizontal margin, calculated during resize.
- Inherited From:
- Default Value:
- 0
- Source:
-
<readonly> totalMarginY :Number
-
Total vertical margin, calculated during resize.
- Inherited From:
- Default Value:
- 0
- Source:
-
<readonly> tweens :Object
-
All tweens affecting this entity that were initiated by ig.EntityExtended#tween.
- these tweens are automatically deleted when complete- Inherited From:
- Source:
-
type :Bitflag|Number
-
Entity type, expanded for more flexibility and specificity. IMPORTANT: for an entity to avoid being ignored in checks, it must either collide, checkAgainst, or have a type!
- Inherited From:
- Default Value:
- none
- Source:
- See:
-
vertices :Array
-
List of vertices based on bounds, relative to entity.
- not calculated by default for performance reasons
- to manually enable, use ig.EntityExtended#needsVertices- Inherited From:
- Source:
-
verticesWorld :Array
-
List of vertices based on bounds, relative to world space.
- not calculated by default for performance reasons
- to manually enable, use ig.EntityExtended#needsVertices- Inherited From:
- Source:
-
visible
-
UI elements are usually always visible.
- this plays well when UI element is also ig.UIElement#fixed- Inherited From:
- Default Value:
- true
- Source:
-
<readonly> wasChecking :Boolean
-
Whether entity was checking against another entity matching ig.Entity#checkAgainst flag.
- Inherited From:
- Default Value:
- false
- Source:
-
zIndex
-
Overlays should be behind anything else on same layer.
- Inherited From:
- Source:
Methods
-
activate(entity)
-
Do some activated behavior.
Parameters:Name Type Argument Description entity
Entity <optional>
causing activation. - Inherited From:
- Source:
-
addAnim(name, settings)
-
Adds an animation to an entity.
Parameters:
- uses ig.AnimationExtended instead of the original ig.AnimationName Type Argument Description name
String name of animation settings
Object <optional>
settings based on animation properties - Inherited From:
- Source:
- See:
-
addControl()
-
Adds control to entity. Tip: this allows entity to call ig.GameExtended#updateChanges during update cycle.
- Inherited From:
- Source:
-
angleTo(from) → {Number}
-
Calculates angle from this entity to another entity or position.
Parameters:Name Type Description from
ig.EntityExtended | Vector2 | Object entity or position to find angle to. - Inherited From:
- Source:
{ Number } angle -
animOverride(animName, settings)
-
Plays an animation and sets animation as override until complete to ensure that no other animations play.
Parameters:Name Type Argument Description animName
String name of animation to play. settings
Object <optional>
settings object. - Inherited From:
- Source:
// settings is a plain object settings = {}; // use an animation from another entity settings.entity = otherEntity; // don't auto release override settings.lock = true; // loop overriding animation // also does not auto release override settings.loop = true; // play animation in reverse settings.reverse = true; // call a function when override completes settings.callback = function () {...}; // call the callback in a context settings.context = callbackContext;
-
animRelease(name, silent)
-
Removes animation override, see ig.EntityExtended.animOverride.
Parameters:Name Type Argument Default Description name
String <optional>
any specific name of overriding animation to release. If does not match will not release. silent
Boolean <optional>
false whether to suppress callback. - Inherited From:
- Source:
-
applyAntiGravity()
-
Applies velocity to counteract gravity.
- Inherited From:
- Source:
-
applyAntiVelocity()
-
Zeroes out velocity.
- Inherited From:
- Source:
-
applyAntiVelocityX()
-
Zeroes out horizontal velocity.
- Inherited From:
- Source:
-
applyAntiVelocityY()
-
Zeroes out vertical velocity.
- Inherited From:
- Source:
-
castShadow(light, context, point, minX, minY, radius)
-
Fill context with the shadow cast by this entity from a point within a light, constrained by the given bounds.
Parameters:Name Type Description light
ig.EntityLight to cast shadows from context
CanvasRenderingContext2D The canvas context onto which the shadows will be cast. point
Object point that represents where the light is coming from. minX
Number left position of light minY
Number top position of light radius
Number radius of light - Inherited From:
- Source:
-
changePerformance() → {Boolean}
-
Makes changes based on this entity's performance level.
- Inherited From:
- Source:
{ Boolean } whether changed or not. -
changePerformanceDynamic()
-
- Inherited From:
- Source:
-
changePerformanceMovable()
-
Called when performance changed to movable.
- Inherited From:
- Source:
-
changePerformanceStatic()
-
Called when performance changed to static.
- Inherited From:
- Source:
-
check(entity)
-
Checks this entity against another entity that matches this entity's ig.EntityExtended#type.
Parameters:Name Type Argument Description entity
ig.EntityExtended <optional>
other entity. - Inherited From:
- Source:
- See:
-
- ig.Entity.
-
cleanup()
-
- Inherited From:
- Source:
-
cleanupCollision()
-
Cleans entity of previous collision properties just before new collision checks.
- Inherited From:
- Source:
-
cleanupPersistent()
-
Does cleanup on persistent changes to game made by this entity, ex: UI elements.
- Inherited From:
- Source:
-
collideWith(entity, dirX, dirY, nudge, vel, weak)
-
Collides with another entity along a specified axis.
Parameters:Name Type Description entity
ig.EntityExtended entity colliding with. dirX
Number horizontal direction of colliding entity dirY
Number vertical direction of colliding entity nudge
Number nudge amount in direction vel
Number velocity in direction weak
Boolean weak colliding entity (i.e. only weak moves) - Inherited From:
- Source:
-
createAnim(name, settings)
-
Generates and adds an animation from ig.EntityExtended#animSettings. If no settings passed, creates default idle animation.
Parameters:Name Type Argument Description name
Object <optional>
name of animation. settings
Object <optional>
settings for animation. - Inherited From:
- Source:
- See:
-
deactivate(entity)
-
Do some deactivated behavior.
Parameters:Name Type Argument Description entity
Entity <optional>
causing deactivation. - Inherited From:
- Source:
-
death(animNameDeath)
-
Shows death animation, automatically called when entity is first killed. Tip: it is not recommended to call this method, but it is fine to override it!
Parameters:Name Type Argument Default Description animNameDeath
String <optional>
"death" + direction name of death animation to play - Inherited From:
- Source:
-
die()
-
Automatically called after entity finished being killed. IMPORTANT: for full animated death, use ig.EntityExtended#kill instead.
- Inherited From:
- Source:
-
distanceEdgeTo(from) → {Number}
-
Calculates distance from edge of this entity to edge of another entity or position.
Parameters:Name Type Description from
ig.EntityExtended | Vector2 | Object entity or position to find distance to. - Inherited From:
- Source:
{ Number } distance -
distanceSquaredEdgeTo(from) → {Number}
-
Calculates distance squared from edge of this entity to edge of another entity or position.
Parameters:
- this is faster than distanceEdgeTo as it avoids sqrt, but the distance is squaredName Type Description from
ig.EntityExtended | Vector2 | Object entity or position to find distance to. - Inherited From:
- Source:
{ Number } distance -
distanceSquaredTo(from) → {Number}
-
Calculates distance squared from center of this entity (in world space) to center of another entity or position (in world space).
Parameters:
- this is faster than distanceTo as it avoids sqrt, but the distance is squaredName Type Description from
ig.EntityExtended | Vector2 | Object entity or position to find distance to. - Inherited From:
- Source:
{ Number } distance squared -
distanceTo(from) → {Number}
-
Calculates distance from center of this entity to center of another entity or position.
Parameters:Name Type Description from
ig.EntityExtended | Vector2 | Object entity or position to find distance to. - Inherited From:
- Source:
{ Number } distance -
draw()
-
Draws ui element fill first if present, and animation last.
- Inherited From:
- Source:
-
fadeIn(settings) → {Tween}
-
Convenience function for tween fade to max alpha.
Parameters:Name Type Argument Description settings
Object <optional>
settings for tween. - Inherited From:
- Source:
{ Tween } tween object. -
fadeOut(settings) → {Tween}
-
Convenience function for tween fade out.
Parameters:Name Type Argument Description settings
Object <optional>
settings for tween. - Inherited From:
- Source:
{ Tween } tween object. -
fadeTo(alpha, settings) → {Tween}
-
Simple fade to specified alpha. Only tweens if not already at alpha, but onUpdate and onComplete methods are guaranteed to call at least once.
Parameters:Name Type Argument Description alpha
Number alpha value between 0 and 1. settings
Object <optional>
settings for tween. - Inherited From:
- Source:
{ Tween } tween object if tweening to alpha. -
fadeToDeath(settings) → {Tween}
-
Convenience function for tween fade out and then kill.
Parameters:Name Type Argument Description settings
Object <optional>
settings for tween. - Inherited From:
- Source:
{ Tween } tween object. -
getCenterX() → {Number}
-
Calculates entity's center x position.
- Inherited From:
- Source:
{ Number } horizontal center. -
getCenterY() → {Number}
-
Calculates entity's center x position.
- Inherited From:
- Source:
{ Number } vertical center. -
getDirectionalAnimName(animName) → {String}
-
Gets the directional name of an animation based on whether entity can flip and current facing. IMPORTANT: this method is biased towards facing vertical.
Parameters:Name Type Description animName
String base animation name - Inherited From:
- Source:
{ String } directional animation nameExample// if we begin with an animation named "move" // and this entity can flip horizontally var animName = entity.getAnimName( "move" ); // the result will be "moveX" // while if the entity cannot flip horizontally // but it is facing to the left entity.facing.x = -1; // the result will be "moveLeft"
-
getFillStyle() → {*}
-
Calculates fill style.
- Inherited From:
- Source:
{ * } fill style -
getIsCollidingWithOneWay(entityOneWay) → {Boolean}
-
Approximate check of whether this entity is colliding with the one way blocking direction of another other entity.
Parameters:
- checks for whether the touching edges are within a certain range based on ig.CONFIG#PRECISION_PCT_ONE_SIDED IMPORTANT: the non one way entity does this check to allow it to choose whether to ignore one way block.Name Type Description entityOneWay
ig.EntityExtended one way entity to check against. - Inherited From:
- Source:
{ Boolean } true if this entity is coming from other entity's one way blocking direction. -
getIsMovingSelf() → {Boolean}
-
Calculates if entity is handling its own movement, i.e. dynamic, moving to, etc.
- Inherited From:
- Source:
{ Boolean } if is handling own movement. -
getIsVisible() → {Boolean}
-
Calculates if entity is visible in screen.
- instead of calling this, use ig.EntityExtended#visible- Inherited From:
- Source:
{ Boolean } if is in screen.Example// this is a bad idea var visible = entity.getIsVisible(); // this is a good idea var visible = entity.visible;
-
getLayer() → {ig.Layer}
-
Gets entity layer based on ig.EntityExtended#layerName.
- Inherited From:
- Source:
{ ig.Layer } layer this entity is on. -
getNewVelocity(vel, accel, friction, max)
-
Calculates new velocity on a single axis for entity, and fixes bug of friction not limiting velocity.
Parameters:Name Type Description vel
Number velocity accel
Number acceleration friction
Number friction max
Number max velocity - Inherited From:
- Source:
-
getOpaqueVertices() → {Array}
-
Calculates vertices for shadow casting just before first shadow is cast since changed.
- Inherited From:
- Source:
{ Array } vertices for shadow casting -
getPosDrawX() → {Number}
-
Calculates entity's draw x position, offset included.
- Inherited From:
- Source:
{ Number } draw x position. -
getPosDrawY() → {Number}
-
Calculates entity's draw y position, offset included.
- Inherited From:
- Source:
{ Number } draw y position. -
getSizeDrawX() → {Number}
-
Calculates horizontal size, offset included.
- Inherited From:
- Source:
{ Number } total horizontal size. -
getSizeDrawY() → {Number}
-
Calculates horizontal size, offset included.
- Inherited From:
- Source:
{ Number } total vertical size. -
getVertices() → {Array}
-
Calculates vertices based on entity's size.
- vertices are relative to entity, not world space, and are not scaled to window
- instead of calling this, use ig.EntityExtended#vertices- Inherited From:
- Source:
{ Array } vertices.Example// normally, vertices are never calculated // but you can force vertices to be updated on change entity.needsVertices = true; // this is a bad idea var vertices = entity.getVertices(); // this is a good idea var vertices = entity.vertices;
-
getVerticesWorld() → {Array}
-
Calculates vertices in world space.
- verticesWorld are in world space and are not scaled to window
- instead of calling this, use ig.EntityExtended#verticesWorld- Inherited From:
- Source:
{ Array } vertices.Example// normally, vertices are never calculated // but you can force vertices to be updated on change entity.needsVertices = true; // this is a bad idea var verticesWorld = entity.getVerticesWorld(); // this is a good idea var verticesWorld = entity.verticesWorld;
-
handleMovementTrace()
-
Enhanced handling of results of collision with collision map.
- Inherited From:
- Source:
// generally, climbable tiles are IGNORED // if we need them we should be using game's shapesPasses myGame.shapesPasses = [ { ignoreSolids: true, ignoreOneWays: true } ] // this is because movement trace only catches collisions // and it does not record the tile(s) this entity is within // but the above shapes passes will extract climbable shapes // and create entities of them, so we can know when // one entity is within another entity that is climbable
-
hide()
-
Sets ig.EntityExtended#hidden to true.
- Inherited From:
- Source:
-
init(x, y, settings)
-
Initializes entity.
Parameters:
- initializes types for checks, via ig.EntityExtended#initTypes
- initializes properties that are created at run-time, such as signals and timers, via ig.EntityExtended#initProperties
- resets entity, merges in new settings, and initializes animations via ig.EntityExtended#resetName Type Argument Description x
Number x position. y
Number y position. settings
Object <optional>
settings object. - Inherited From:
- Source:
-
initOpaqueVertices()
-
Initializes vertices for shadow casting.
- Inherited From:
- Source:
-
initProperties()
-
Adds properties that should only be initialized once.
- Inherited From:
- Source:
-
initTypes()
-
- Inherited From:
- Source:
-
intersectWith(entity)
-
Called when two entities intersect, regardless of collides and before checks or collisions.
Parameters:Name Type Description entity
ig.EntityExtended entity intersecting. - Inherited From:
- Source:
-
kill(silent)
-
Kills entity and shows optional effects, animation, etc via ig.EntityExtended#death.
Parameters:
- this is not the same as ig.GameExtended#removeEntityName Type Argument Description silent
Boolean <optional>
whether to die without effects or animation. - Inherited From:
- Source:
- See:
-
- ig.Entity.
-
lineOfSight(entity) → {Boolean}
-
Whether this entity can see another in a direct line of sight.
Parameters:Name Type Description entity
ig.EntityExtended entity to check against. - Inherited From:
- Source:
{ Boolean } if sees other. -
link()
-
- Inherited From:
- Source:
-
lookAt(target)
-
Flips entity to face a target entity or position.
Parameters:Name Type Description target
ig.EntityExtended | Vector2 | Object target to look at. - Inherited From:
- Source:
-
manageStart()
-
Called automatically by ig.GameExtended#PlayerManager when managing entity as if player were playing them.
- Inherited From:
- Source:
-
manageStop()
-
Called automatically by ig.GameExtended#PPlayerManager when done managing entity.
- Inherited From:
- Source:
-
moveAllStop()
-
Stops all movement immediately.
- Inherited From:
- Source:
-
moveTo()
-
- Inherited From:
- Source:
-
moveToComplete() → {Boolean}
-
Called when moved to complete.
- Inherited From:
- Source:
{ Boolean } true when move is completed, otherwise is continuing sequence. -
moveToPosition(item, settings)
-
Positions this entity relative to moving to item based on settings.
Parameters:Name Type Argument Description item
ig.EntityExtended | Vector2 | Object item to move to. settings
Object <optional>
settings object. - Inherited From:
- Source:
- See:
-
moveToSequenceNext()
-
Moves to next in current sequence of moving to entities.
- Inherited From:
- Source:
-
moveToStop()
-
- Inherited From:
- Source:
-
moveToUpdate()
-
Updates any moveTo in progress.
- Inherited From:
- Source:
-
pause()
-
- Inherited From:
- Source:
-
projectShadow(point, radius, a, b, pointToA, pointToB, aToB) → {Array}
-
Projects an edge based on an point.
Parameters:Name Type Description point
Vector2 | Object 2d point to project from. radius
Number a
Object edge vertex a. b
Object edge vertex b. pointToA
Vector2 | Object 2d vector from point to vertex a. pointToB
Vector2 | Object 2d vector from point to vertex b. aToB
Object 2d vector from vertex a to vertex b. - Inherited From:
- Source:
{ Array } vertices of the shape cast by light from edge. -
ready()
-
- Inherited From:
- Source:
-
rebuild()
-
- Inherited From:
- Source:
-
receiveDamage(amount, from, unblockable) → {Boolean}
-
Does damage to entity while checking if invulnerable.
Parameters:Name Type Argument Description amount
Number amount of damage. from
ig.EntityExtended <optional>
entity causing damage. unblockable
Boolean <optional>
whether damage cannot be blocked. - Inherited From:
- Source:
{ Boolean } whether damage was applied. -
recordChanges(force)
-
Records limited changes in transform and sets ig.EntityExtended#changed and ig.EntityExtended#moving.
Parameters:
- called automatically by ig.EntityExtended#updateName Type Argument Description force
Boolean <optional>
forces changed. - Inherited From:
- Source:
-
recordLast()
-
Records last transform.
- called automatically by ig.EntityExtended#update- Inherited From:
- Source:
-
recordResetState()
-
Records the state of an entity for later reset.
- does not record all properties for performance reasons- Inherited From:
- Source:
-
refill(width, height)
-
Refreshes fill.
Parameters:Name Type Argument Default Description width
Number <optional>
sizeDraw.x width to fill height
Number <optional>
sizeDraw.y height to fill - Inherited From:
- Source:
-
refresh(force)
-
Refreshes entity size, position, etc when screen is resized or linked to is refreshed. Tip: usually this is best applied to UI elements and not dynamic entities.
Parameters:Name Type Argument Description force
Boolean <optional>
whether to force. - Inherited From:
- Source:
-
removeControl()
-
Removes control from entity. Tip: this blocks entity from calling ig.GameExtended#updateChanges during update cycle.
- Inherited From:
- Source:
-
reposition(force)
-
Refreshes position.
Parameters:Name Type Argument Description force
Boolean <optional>
whether to force. - Inherited From:
- Source:
-
reset(x, y, settings)
-
Resets an entity to last state.
Parameters:Name Type Argument Description x
Number x position. y
Number y position. settings
Object <optional>
settings object. - Inherited From:
- Source:
-
resetCore(x, y, settings)
-
Resets settings and position of entity.
Parameters:Name Type Argument Description x
Number x position. y
Number y position. settings
Object <optional>
settings object. - Inherited From:
- Source:
-
resetExtras()
-
- Inherited From:
- Source:
-
resetToInitAnim()
-
Resets current anim to initial animation.
- Inherited From:
- Source:
-
resize()
-
- Inherited From:
- Source:
-
setControllable(controllable)
-
Sets whether entity can control self.
Parameters:Name Type Argument Default Description controllable
Boolean <optional>
true - Inherited From:
- Source:
-
setGrounded(withoutVelocity)
-
Sets entity as grounded. Only changes gravity state if has gravity.
Parameters:Name Type Argument Default Description withoutVelocity
Boolean <optional>
false whether to leave velocity untouched - Inherited From:
- Source:
-
setHidden(hidden)
-
Sets ig.EntityExtended#hidden.
Parameters:Name Type Argument Default Description hidden
Boolean <optional>
false whether entity should be hidden. - Inherited From:
- Source:
-
setPerformance()
-
Sets this entity's performance level.
- Inherited From:
- Source:
-
setUngrounded()
-
Sets entity as ungrounded.
- Inherited From:
- Source:
-
spawn()
-
Called after ig.EntityExtended#ready when spawn animation is complete.
- sets ig.EntityExtended#currentAnim to ig.EntityExtended#animInit if present
- activates entity if ig.EntityExtended#activated is true- Inherited From:
- Source:
-
toggleActivate(entity)
-
Toggles between activate and deactivate.
Parameters:Name Type Argument Description entity
Entity <optional>
causing deactivation. - Inherited From:
- Source:
-
touches(entity) → {Boolean}
-
Whether this entity touches another.
Parameters:Name Type Description entity
ig.EntityExtended entity to check against. - Inherited From:
- Source:
{ Boolean } if touches other. -
tween(properties, settings) → {Tween}
-
Simple tween of specified properties. IMPORTANT: make sure this entity has all tweening properties.
Parameters:Name Type Argument Description properties
Object property values on entity. settings
Object <optional>
settings for tween, based on ig.TWEEN.tween. - Inherited From:
- Source:
{ Tween } tween object. -
tweenEnd(name)
-
Stops tweens on this entity. IMPORTANT: if no specific tween name passed, will stop all tweens.
Parameters:Name Type Argument Description name
String <optional>
name of specific tween. - Inherited From:
- Source:
-
unhide()
-
Sets ig.EntityExtended#hidden to false.
- Inherited From:
- Source:
-
unlink()
-
- Inherited From:
- Source:
-
unpause()
-
- Inherited From:
- Source:
-
update()
-
- Inherited From:
- Source:
-
updateBounds()
-
Updates bounds.
- called automatically by ig.EntityExtended#recordChanges when ig.EntityExtended#needsBounds- Inherited From:
- Source:
-
updateChanges()
-
Changes entity.
- called automatically by ig.EntityExtended#update Tip: use this method to handle moving, acting, etc, instead of the main update method.- Inherited From:
- Source:
-
updateDynamics()
-
Updates dynamic properties such as velocity, gravity, collisions with collision map, etc.
- called automatically by ig.EntityExtended#update IMPORTANT: if you change the way bounds are calculated you will also need to override the updateDynamics method!- Inherited From:
- Source:
-
updateVelocity()
-
Updates velocity based on acceleration and friction.
- called automatically by ig.EntityExtended#updateDynamics- Inherited From:
- Source:
-
updateVisible()
-
Called when visible to update animations.
- called automatically by ig.EntityExtended#update- Inherited From:
- Source: