A_SpawnParticle

From ZDoom Wiki
Jump to navigation Jump to search

void A_SpawnParticle(color color1, int flags = 0, int lifetime = TICRATE, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0)

Usage

Spawns a single particle.

For a version that supports custom graphics, see A_SpawnParticleEx.

For a more robust struct-using version see SpawnParticle (ZScript).

Parameters

  • color1: The color of the particle. Can be used with a hexadecimal value or a predefined value such as "Black".
  • flags: Customizes the behavior of the function. Multiple flags can be combined by using the bitwise OR operator (|) between the constant names:
  • SPF_FULLBRIGHT — Makes the particle full bright.
  • SPF_NOTIMEFREEZE — The spawned particle is not affected by the time freeze powerup or cheat.
  • SPF_ROLL - The particle is allowed to use its' startroll, rollvel, and rollacc parameters.
  • SPF_ROLLCENTER — Rolls the particle around the center of the graphic regardless of offsets, like the ROLLCENTER actor flag. (New from 4.13.0)
  • SPF_REPLACE — If the the particle limit is reached, the oldest particles will be removed to make room for particles with SPF_REPLACE.
  • SPF_NO_XY_BILLBOARD - The particle does not have any sort of billboarding, causing it to render similarly to normal actor sprites, instead of facing the players' view at all times.
  • SPF_LOCAL_ANIM — Spawns an animated particle whose animation runs independently of the games' timer. This means the graphics can be animated at different times, and that pausing the game also stops them from running.
  • SPF_NEGATIVE_FADESTEP — Forces negative fadestep to be interpreted literally, causing the particle to fade in (for example, with this flag a fadestep of -0.1 will cause the particle's alpha to increase by 0.1 every tic). Without this flag, any negative fadestep value will cause the particle to gradually fade out over its lifetime. (New from 4.13.0)
  • SPF_FACECAMERA — Makes the particle graphic face the camera. Like the BILLBOARDFACECAMERA actor flag. (New from 4.13.0)
  • SPF_NOFACECAMERA — Makes the particle graphic face the opposite direction the camera. Like the BILLBOARDNOFACECAMERA actor flag. (New from 4.13.0)
  • SPF_STRETCHPIXELS — Rolling particle graphics will not ignore aspect ratio correction and continue to appear stretched. (New from 4.13.1)
  • SPF_RELPOS — Position is relative to angle.
  • SPF_RELVEL — Velocity is relative to angle.
  • SPF_RELACCEL — Acceleration is relative to angle.
  • SPF_RELANG — Adds the calling actor's angle to angle for relativity.
  • SPF_RELATIVE — Combines the SPF_RELPOS, SPF_RELVEL, SPF_RELACCEL and SPF_RELANG flags.
Default is 0.
  • lifetime: The lifetime of the particle in tics. Default is TICRATE which equals to one second (35 tics).
  • size: The size of the particle. Default is 1.
  • angle: The angle to offset the particle by. Default is 0.
  • x/yoff: The distance from the actor to spawn the particle along the X axis. Note that this is not relative. Default is 0.
  • zoff: How high up to spawn the particle from the actor's Z position. Default is 0.
  • velx/y/z: The velocity along the X/Y/Z axis to apply to the particle. This is in absolute direction, not relative. Default is 0.
  • accelx/y/z: Defines how much to accelerate the particle by over its lifespan. Default is 0.
  • startalphaf: Specifies the particle's alpha upon spawning. Default is 1.0.
  • fadestepf: The amount by which the particle fades each tic. The particle is automatically removed early if it fades completely before lifetime expires. -1 indicates automatic (a complete fade-out over the length of lifetime). Default is -1.
  • sizestep: The particle grows or shrinks in size by this amount per tic.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.


See also