Displays particles.

Hierarchy (view full)

Constructors

Properties

Methods

activateBehavior addEffect addForce addForceTowardObject addForceTowardPosition addNewBehavior addPolarForce averageForceAngleIs behaviorActivated clearEffects clearForces collisionTest cursorOnObject deleteFromScene distanceTest enableEffect extraInitializationFromInitialInstance get3DRendererObject getAABB getAABBBottom getAABBCenterX getAABBCenterY getAABBLeft getAABBRight getAABBTop getAdditiveRendering getAngle getAngleToObject getAngleToPosition getAverageForce getBehavior getCenterX getCenterXInScene getCenterY getCenterYInScene getConeSprayAngle getDistanceToObject getDistanceToPosition getDrawableX getDrawableY getElapsedTime getEmitterAngle getEmitterAngleA getEmitterAngleB getEmitterForceMax getEmitterForceMin getFlow getHeight getHitBoxes getHitBoxesAround getInstanceContainer getLayer getMaxParticlesCount getName getNameId getNameIdentifier getNetworkSyncData getParent getParticleAlpha1 getParticleAlpha2 getParticleBlue1 getParticleBlue2 getParticleCount getParticleGravityAngle getParticleGravityLength getParticleGravityX getParticleGravityY getParticleGreen1 getParticleGreen2 getParticleLifeTimeMax getParticleLifeTimeMin getParticleRed1 getParticleRed2 getParticleRotationMaxSpeed getParticleRotationMinSpeed getParticleSize1 getParticleSize2 getRendererEffects getRendererObject getRuntimeScene getSqDistanceToObject getSqDistanceToPosition getTank getTexture getTimerElapsedTimeInSeconds getTimerElapsedTimeInSecondsOrNaN getUniqueId getVariableChildCount getVariableNumber getVariableString getVariables getVisibilityAABB getWidth getX getXFromAngleAndDistance getY getYFromAngleAndDistance getZOrder getZoneRadius hasBehavior hasEffect hasNoForces hasVariable hide insideObject invalidateHitboxes isCollidingWithPoint isEffectEnabled isEmitting isHidden isIncludedInParentCollisionMask isOnLayer isTotalForceAngleAround isVisible jumpEmitterForwardInTime noMoreParticles notifyBehaviorsObjectHotReloaded onCreated onDeletedFromScene onDestroyed onScenePaused onSceneResumed pauseTimer putAround putAroundObject raycastTest recreateParticleSystem registerDestroyCallback reinitialize removeBehavior removeEffect removeTimer resetTimer returnVariable rotate rotateTowardAngle rotateTowardPosition separateFromObjects separateFromObjectsList separateObjectsWithForces separateObjectsWithoutForces setAdditiveRendering setAngle setCenterPositionInScene setCenterXInScene setCenterYInScene setConeSprayAngle setEffectBooleanParameter setEffectDoubleParameter setEffectStringParameter setEmitterAngle setEmitterAngleA setEmitterAngleB setEmitterForceMax setEmitterForceMin setFlow setHeight setIncludedInParentCollisionMask setLayer setMaxParticlesCount setParticleAlpha1 setParticleAlpha2 setParticleBlue1 setParticleBlue2 setParticleColor1 setParticleColor1AsNumber setParticleColor2 setParticleColor2AsNumber setParticleGravityAngle setParticleGravityLength setParticleGravityX setParticleGravityY setParticleGreen1 setParticleGreen2 setParticleLifeTimeMax setParticleLifeTimeMin setParticleRed1 setParticleRed2 setParticleRotationMaxSpeed setParticleRotationMinSpeed setParticleSize1 setParticleSize2 setPosition setTank setTexture setVariableNumber setVariableString setWidth setX setY setZOrder setZoneRadius startEmission stepBehaviorsPostEvents stepBehaviorsPreEvents stopEmission timerElapsedTime timerPaused unpauseTimer unregisterDestroyCallback update updateAABB updateAllEffectParameters updateForces updateFromNetworkSyncData updateFromObjectData updateHitBoxes updatePreRender updateTimers

Constructors

Properties

additiveRendering: boolean
alpha1: number
alpha2: number
angle: number = 0
angleA: number

Deprecated

Data not used

angleB: number
color1: number
color2: number
destroyWhenNoParticles: boolean
flow: number
forceMax: number
forceMin: number
forcesGarbage: Force[] = []

Global container for unused forces, avoiding recreating forces each tick.

Static

getFirstVariableNumber: ((array) => number) = ...

Shortcut to get the first value of an array variable as a number.

Type declaration

    • (array): number
    • Parameters

      Returns number

getFirstVariableNumber: ((array) => number) = RuntimeObject.getFirstVariableNumber

Type declaration

    • (array): number
    • Shortcut to get the first value of an array variable as a number.

      Parameters

      Returns number

getFirstVariableString: ((array) => string) = ...

Shortcut to get the first value of an array variable as a string.

Type declaration

    • (array): string
    • Parameters

      Returns string

getFirstVariableString: ((array) => string) = RuntimeObject.getFirstVariableString

Type declaration

    • (array): string
    • Shortcut to get the first value of an array variable as a string.

      Parameters

      Returns string

getLastVariableNumber: ((array) => number) = ...

Shortcut to get the last value of an array variable as a number.

Type declaration

    • (array): number
    • Parameters

      Returns number

getLastVariableNumber: ((array) => number) = RuntimeObject.getLastVariableNumber

Type declaration

    • (array): number
    • Shortcut to get the last value of an array variable as a number.

      Parameters

      Returns number

getLastVariableString: ((array) => string) = ...

Shortcut to get the last value of an array variable as a string.

Type declaration

    • (array): string
    • Parameters

      Returns string

getLastVariableString: ((array) => string) = RuntimeObject.getLastVariableString

Type declaration

    • (array): string
    • Shortcut to get the last value of an array variable as a string.

      Parameters

      Returns string

getSqDistanceTo: ((targetX, targetY) => number) = RuntimeObject.prototype.getSqDistanceToPosition

Get the squared distance, in pixels, from the object center to a position.

Type declaration

    • (targetX, targetY): number
    • Parameters

      • targetX: number
      • targetY: number

      Returns number

Deprecated

Use getSqDistanceToPosition instead.

getVariableBoolean: ((variable, compareWith) => boolean) = RuntimeObject.getVariableBoolean

Type declaration

    • (variable, compareWith): boolean
    • Private

      Shortcut to compare the value of a variable considered as a boolean. This shortcut function is needed for events code generation.

      Parameters

      Returns boolean

getVariableChildCount: ((variable) => number) = RuntimeObject.getVariableChildCount

Type declaration

    • (variable): number
    • Get the number of children from a variable

      Parameters

      • variable: Variable

        The variable to be accessed

      Returns number

      The number of children

      Static

getVariableNumber: ((variable) => number) = RuntimeObject.getVariableNumber

Type declaration

    • (variable): number
    • Get the value of a variable considered as a number. Equivalent of variable.getAsNumber()

      Parameters

      • variable: Variable

        The variable to be accessed

      Returns number

      The value of the specified variable

      Static

getVariableString: ((variable) => string) = RuntimeObject.getVariableString

Type declaration

    • (variable): string
    • Get the value of a variable considered as a string. Equivalent of variable.getAsString()

      Parameters

      • variable: Variable

        The variable to be accessed

      Returns string

      The string of the specified variable

      Static

gravityX: number
gravityY: number
hidden: boolean = false
id: number
jumpForwardInTimeOnCreation: number
layer: string = ''
lifeTimeMax: number
lifeTimeMin: number
maxParticlesCount: number
name: string
networkId: null | string = null

A network ID associated to the object to be used for multiplayer, to identify the object across peers. We don't use persistentUuid as it's only used for hot-reload. We don't use the object ID either as it's not unique across peers.

particleRotationMaxSpeed: number
particleRotationMinSpeed: number
persistentUuid: null | string = null

An optional UUID associated to the object to be used for hot reload. Don't modify or use otherwise.

pick: boolean = false

A property to be used by external algorithms to indicate if the object is picked or not in an object selection. By construction, this is not "thread safe" or "re-entrant algorithm" safe.

rendererParam1: number
rendererParam2: number
rendererType: string
returnVariable: ((variable) => Variable) = RuntimeObject.returnVariable

Type declaration

    • (variable): Variable
    • Return the variable passed as argument without any change. Only for usage by events.

      Parameters

      • variable: Variable

        The variable to be accessed

      Returns Variable

      The specified variable

      Static

setVariableBoolean: ((variable, newValue) => void) = RuntimeObject.setVariableBoolean

Type declaration

    • (variable, newValue): void
    • Private

      Shortcut to set the value of a variable considered as a boolean. This shortcut function is needed for events code generation.

      Parameters

      Returns void

setVariableNumber: ((variable, newValue) => void) = RuntimeObject.setVariableNumber

Type declaration

    • (variable, newValue): void
    • Shortcut to set the value of a variable considered as a number

      Parameters

      • variable: Variable

        The variable to be changed

      • newValue: number

        The value to be set

      Returns void

setVariableString: ((variable, newValue) => void) = RuntimeObject.setVariableString

Type declaration

    • (variable, newValue): void
    • Shortcut to set the value of a variable considered as a string

      Parameters

      • variable: Variable

        The variable to be changed

      • newValue: string

        {String} The value to be set

      Returns void

size1: number
size2: number
supportsReinitialization: boolean = false
tank: number
texture: string
toggleVariableBoolean: ((variable) => void) = RuntimeObject.toggleVariableBoolean

Type declaration

    • (variable): void
    • Private

      Toggles a variable. This shortcut function is needed for events code generation.

      Parameters

      Returns void

      See

type: string
valuePush: ((array, value) => void) = RuntimeObject.valuePush

Type declaration

    • (array, value): void
    • Private

      This shortcut function is needed for events code generation.

      Parameters

      • array: Variable
      • value: string | number | boolean

      Returns void

variableChildExists: ((variable, childName) => boolean) = RuntimeObject.variableChildExists

Type declaration

    • (variable, childName): boolean
    • Parameters

      • variable: Variable

        The variable to be tested

      • childName: string

        The name of the child

      Returns boolean

variableClearChildren: ((variable) => void) = RuntimeObject.variableClearChildren

Type declaration

    • (variable): void
    • Parameters

      • variable: Variable

        The variable to be cleared

      Returns void

variablePushCopy: ((array, variable) => void) = RuntimeObject.variablePushCopy

Type declaration

    • (array, variable): void
    • Private

      This shortcut function is needed for events code generation.

      Parameters

      Returns void

variableRemoveAt: ((array, index) => void) = RuntimeObject.variableRemoveAt

Type declaration

    • (array, index): void
    • Private

      This shortcut function is needed for events code generation.

      Parameters

      Returns void

variableRemoveChild: ((variable, childName) => void) = RuntimeObject.variableRemoveChild

Type declaration

    • (variable, childName): void
    • Parameters

      • variable: Variable

        The variable to be changed

      • childName: string

        The name of the child

      Returns void

x: number = 0
y: number = 0
zOrder: number = 0
zoneRadius: number
aabb: AABB = ...
hitBoxes: Polygon[]
hitBoxesDirty: boolean = true
getVariableBoolean: ((variable, compareWith) => boolean) = ...

Shortcut to compare the value of a variable considered as a boolean. This shortcut function is needed for events code generation.

Type declaration

    • (variable, compareWith): boolean
    • Parameters

      Returns boolean

Returns

setVariableBoolean: ((variable, newValue) => void) = ...

Shortcut to set the value of a variable considered as a boolean. This shortcut function is needed for events code generation.

Type declaration

    • (variable, newValue): void
    • Parameters

      Returns void

toggleVariableBoolean: ((variable) => void) = ...

Toggles a variable. This shortcut function is needed for events code generation.

Type declaration

    • (variable): void
    • Parameters

      Returns void

See

valuePush: ((array, value) => void) = ...

This shortcut function is needed for events code generation.

Type declaration

    • (array, value): void
    • Parameters

      • array: Variable
      • value: string | number | boolean

      Returns void

variablePushCopy: ((array, variable) => void) = ...

This shortcut function is needed for events code generation.

Type declaration

variableRemoveAt: ((array, index) => void) = ...

This shortcut function is needed for events code generation.

Type declaration

    • (array, index): void
    • Parameters

      Returns void

Methods

  • Add a force to the object to move it.

    Parameters

    • x: number

      The x coordinates of the force

    • y: number

      The y coordinates of the force

    • multiplier: number

      Set the force multiplier

    Returns void

  • Add a force oriented toward a position

    Parameters

    • x: number

      The target x position

    • y: number

      The target y position

    • len: number

      The force length, in pixels.

    • multiplier: number

      Set the force multiplier

    Returns void

  • Create the behavior described by the given BehaviorData

    Parameters

    • behaviorData: BehaviorData

      The data to be used to construct the behavior.

    Returns boolean

    true if the behavior was properly created, false otherwise.

  • Add a force using polar coordinates.

    Parameters

    • angle: number

      The angle of the force, in degrees.

    • len: number

      The length of the force, in pixels.

    • multiplier: number

      Set the force multiplier

    Returns void

  • Return true if the average angle of the forces applied on the object is in a given range.

    Parameters

    • angle: number

      The angle to be tested.

    • toleranceInDegrees: number

      The length of the range :

    Returns boolean

    true if the difference between the average angle of the forces and the angle parameter is inferior to toleranceInDegrees parameter.

    Deprecated

    Use isTotalForceAngleAround instead.

  • Return true if the hitboxes of two objects are overlapping

    Parameters

    • obj1: RuntimeObject

      The first runtimeObject

    • obj2: RuntimeObject

      The second runtimeObject

    • ignoreTouchingEdges: boolean

      If true, then edges that are touching each other, without the hitbox polygons actually overlapping, won't be considered in collision.

    • ignoredObject1Polygon: null | Polygon = null

      A polygon from the obj1 collision mask to ignore

    Returns boolean

    true if obj1 and obj2 are in collision

    Static

  • Called when the object is created from an initial instance at the startup of the scene.
    Note that common properties (position, angle, z order...) have already been setup.

    Parameters

    • initialInstanceData: InstanceData

      The data of the initial instance.

    Returns void

  • Get the AABB (axis aligned bounding box) for the object.

    The default implementation uses either the position/size of the object (when angle is 0) or hitboxes (when angle is not 0) to compute the bounding box. Result is cached until invalidated (by a position change, angle change...).

    You should probably redefine updateAABB instead of this function.

    Returns AABB

    The bounding box

  • Get a behavior from its name. If the behavior does not exists, undefined is returned.

    Never keep a reference to a behavior, as they can be hot-reloaded. Instead, always call getBehavior on the object.

    Parameters

    • name: string

      {String} The behavior name.

    Returns null | RuntimeBehavior

    The behavior with the given name, or undefined.

  • Return the X position of the object center, relative to the object X position (getDrawableX). Use getCenterXInScene to get the position of the center in the scene.

    Returns number

    the X position of the object center, relative to getDrawableX().

  • Return the Y position of the object center, relative to the object position (getDrawableY). Use getCenterYInScene to get the position of the center in the scene.

    Returns number

    the Y position of the object center, relative to getDrawableY().

  • Get the X position of the rendered object.

    For most objects, this will returns the same value as getX(). But if the object has an origin that is not the same as the point (0,0) of the object displayed, getDrawableX will differ.

    Returns number

    The X position of the rendered object.

  • Get the Y position of the rendered object.

    For most objects, this will returns the same value as getY(). But if the object has an origin that is not the same as the point (0,0) of the object displayed, getDrawableY will differ.

    Returns number

    The Y position of the rendered object.

  • Return the time elapsed since the last frame, in milliseconds, for the object.

    Objects can have different elapsed time if they are on layers with different time scales.

    Parameters

    • Optional instanceContainer: RuntimeInstanceContainer

      The instance container the object belongs to (deprecated - can be omitted).

    Returns number

  • Return at least all the hit boxes that overlap a given area.

    The hit boxes don't need to actually overlap the area, (i.e: it's correct to return more hit boxes than those in the specified area) but the ones that do must be returned.

    The default implementation returns the same as getHitBoxes.

    This method can be overridden by grid based objects (or other objects that can quickly compute which hitboxes are touching a given area) to optimize collision checks.

    When overriding this method, the following ones should be overridden too:

    Parameters

    • left: number

      bound of the area in scene coordinates

    • top: number

      bound of the area in scene coordinates

    • right: number

      bound of the area in scene coordinates

    • bottom: number

      bound of the area in scene coordinates

    Returns Iterable<Polygon>

    at least all the hit boxes that overlap a given area.

  • Get the identifier associated to an object name. Some features may want to compare objects name a large number of time. In this case, it may be more efficient to compare objects name identifiers.

    Parameters

    • name: string

    Returns number

    Static

  • Get a timer elapsed time.

    This is used by expressions to return 0 when a timer doesn't exist because numeric expressions must always return a number.

    Parameters

    • timerName: string

      The timer name.

    Returns number

    The timer elapsed time in seconds, 0 if the timer doesn't exist.

  • Get a timer elapsed time.

    This is used by conditions to return false when a timer doesn't exist, no matter the relational operator.

    Parameters

    • timerName: string

      The timer name.

    Returns number

    The timer elapsed time in seconds, NaN if the timer doesn't exist.

  • Get the unique identifier of the object.
    The identifier is set by the runtimeScene owning the object.
    You can also use the id property (this._object.id) for increased efficiency instead of calling this method.

    Returns number

    The object identifier

  • Get the AABB (axis aligned bounding box) to be used to determine if the object is visible on screen. The gdjs.RuntimeScene will hide the renderer object if the object is not visible on screen ("culling").

    The default implementation uses the AABB returned by getAABB.

    If null is returned, the object is assumed to be always visible.

    Returns null | AABB

    The bounding box or null.

  • Compute the X position when given an angle and distance relative to the starting object. This is also known as getting the cartesian coordinates of a 2D vector, using its polar coordinates.

    Parameters

    • angle: number

      The angle, in degrees.

    • distance: number

      The distance from the object, in pixels

    Returns number

  • Compute the Y position when given an angle and distance relative to the starting object. This is also known as getting the cartesian coordinates of a 2D vector, using its polar coordinates.

    Parameters

    • angle: number

      The angle, in degrees.

    • distance: number

      The distance from the object, in pixels

    Returns number

  • Return true if the specified position is inside object bounding box.

    The position should be in "world" coordinates, i.e use gdjs.Layer.convertCoords if you need to pass the mouse or a touch position that you get from gdjs.InputManager. To check if a point is inside the object collision mask, you can use isCollidingWithPoint instead.

    Parameters

    • x: number
    • y: number

    Returns boolean

  • Check if a point is inside the object collision hitboxes.

    Parameters

    • pointX: number

      The point x coordinate.

    • pointY: number

      The point y coordinate.

    Returns boolean

    true if the point is inside the object collision hitboxes.

  • Return true if the angle of the total force applied on the object is in a given range.

    Parameters

    • angle: number

      The angle to be tested.

    • toleranceInDegrees: number

      The maximum distance from the given angle.

    Returns boolean

    true if the difference between the force angle the given angle is less or equals the toleranceInDegrees.

  • Return true if the object is not hidden.

    Note: This is unrelated to the actual visibility of the object on the screen. For this, see getVisibilityAABB to get the bounding boxes of the object as displayed on the scene.

    Returns boolean

    true if the object is not hidden.

  • To be called by the child classes in their constructor, at the very end. Notify the behaviors that they have been constructed (this must be done when the object is ready, otherwise behaviors can do operations on the object which could be not initialized yet).

    If you redefine this function, make sure to call the original method (RuntimeObject.prototype.onCreated.call(this);).

    Returns void

  • Called when the object is destroyed (because it is removed from a scene or the scene is being unloaded). If you redefine this function, make sure to call the original method (RuntimeObject.prototype.onDestroyFromScene.call(this, runtimeScene);).

    Parameters

    Returns void

  • Put the object around a position, with a specific distance and angle. The distance and angle are computed between the position and the center of the object.

    Parameters

    • x: number

      The x position of the target

    • y: number

      The y position of the target

    • distance: number

      The distance between the object and the target, in pixels.

    • angleInDegrees: number

      The angle between the object and the target, in degrees.

    Returns void

  • Put the object around another object, with a specific distance and angle. The distance and angle are computed between the centers of the objects.

    Parameters

    • obj: null | RuntimeObject

      The target object

    • distance: number

      The distance between the object and the target

    • angleInDegrees: number

      The angle between the object and the target, in degrees.

    Returns void

  • Called to reset the object to its default state. This is used for objects that are "recycled": they are dismissed (at which point onDestroyFromScene is called) but still stored in a cache to be reused next time an object must be created. At this point, reinitialize will be called. The object must then work as if it was a newly constructed object.

    To implement this in your object:

    • Set gdjs.YourRuntimeObject.supportsReinitialization = true; to declare support for recycling.
    • Implement reinitialize. It must call the reinitialize of gdjs.RuntimeObject, and call this.onCreated(); at the end of reinitialize.
    • It must reset the object as if it was newly constructed (be careful about your renderers and any global state).
    • The _runtimeScene, _nameId, name and type are guaranteed to stay the same and do not need to be set again.

    Parameters

    • objectData: ObjectData

    Returns void

  • Remove the behavior with the given name. Usually only used by hot-reloading, as performance of this operation is not guaranteed (in the future, this could lead to re-organization of arrays holding behaviors).

    Parameters

    • name: string

      The name of the behavior to remove.

    Returns boolean

    true if the behavior was properly removed, false otherwise.

  • Separate the object from others objects, using their hitboxes.

    Parameters

    • objects: RuntimeObject[]

      Objects

    • ignoreTouchingEdges: boolean

      If true, then edges that are touching each other, without the hitbox polygons actually overlapping, won't be considered in collision.

    Returns boolean

    true if the object was moved

  • Separate the object from others objects, using their hitboxes.

    Parameters

    • objectsLists: ObjectsLists

      Tables of objects

    • ignoreTouchingEdges: boolean

      If true, then edges that are touching each other, without the hitbox polygons actually overlapping, won't be considered in collision.

    Returns boolean

    true if the object was moved

  • Change an effect property value (for properties that are booleans).

    Parameters

    • name: string

      The name of the effect to update.

    • parameterName: string

      The name of the property to update.

    • value: boolean

      The new value (boolean).

    Returns boolean

  • Change an effect property value (for properties that are numbers).

    Parameters

    • name: string

      The name of the effect to update.

    • parameterName: string

      The name of the property to update.

    • value: number

      The new value (number).

    Returns boolean

  • Change an effect property value (for properties that are strings).

    Parameters

    • name: string

      The name of the effect to update.

    • parameterName: string

      The name of the property to update.

    • value: string

      The new value (string).

    Returns boolean

  • Compare a timer elapsed time. If the timer does not exist, it is created.

    Parameters

    • timerName: string

      The timer name.

    • timeInSeconds: number

      The time value to check in seconds.

    Returns boolean

    True if the timer exists and its value is greater than or equal than the given time, false otherwise.

    Deprecated

    prefer using getTimerElapsedTimeInSecondsOrNaN.

  • Update the AABB (axis aligned bounding box) for the object.

    Default implementation uses either the position/size of the object (when angle is 0) or hitboxes (when angle is not 0) to compute the bounding box.

    You should not call this function by yourself, it is called when necessary by getAABB method. However, you can redefine it if your object can have a faster implementation.

    Returns void

  • Update the hit boxes for the object.

    The default implementation set a basic bounding box based on the size (getWidth and getHeight) and the center point of the object (getCenterX and getCenterY). Result is cached until invalidated (by a position change, angle change...).

    You should not call this function by yourself, it is called when necessary by getHitBoxes method. However, you can redefine it if your object need custom hit boxes.

    Returns void

  • Updates the object timers. Called once during the game loop, before events and rendering.

    Parameters

    • elapsedTime: number

      The elapsed time since the previous frame in milliseconds.

    Returns void