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 taht 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_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_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_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.
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