Special Effects

Classes responsible for special effect objects, such as Explosion, Debris, Particles, etc.

Enumeration

enum ParticleBlendStyle

The type of visual blending style to apply to the particles.

Parameters:
  • NORMAL – No blending style.
  • ADDITIVE – Adds the color of the pixel to the frame buffer with full alpha for each pixel.
  • SUBTRACTIVE – Subtractive Blending. Reverses the color model, causing dark colors to have a stronger visual effect.
  • PREMULTALPHA – Color blends with the colors of the imagemap rather than the alpha.

Functions

float calcExplosionCoverage(Point3F pos, int id, int covMask)

Calculates how much an explosion effects a specific object. Use this to determine how much damage to apply to objects based on their distance from the explosion’s center point, and whether the explosion is blocked by other objects.

Parameters:
  • pos – Center position of the explosion.
  • id – Id of the object of which to check coverage.
  • covMask – Mask of object types that may block the explosion.
Returns:

Coverage value from 0 (not affected by the explosion) to 1 (fully affected)

Example:

// Get the position of the explosion.
%position = %explosion.getPosition();

// Set a list of TypeMasks (defined in gameFunctioncs.cpp), seperated by the | character.
%TypeMasks = $TypeMasks::StaticObjectType | $TypeMasks::ItemObjectType

// Acquire the damage value from 0.0f - 1.0f.
%coverage = calcExplosionCoverage( %position, %sceneObject, %TypeMasks );

// Apply damage to object
%sceneObject.applyDamage( %coverage * 20 );