Deflectors

Game Maker 8

Deflectors

Deflectors deflect particles when they appear in their region. Note that only the position of the particle is taken into account not its sprite or size. A particle system can have an arbitrary number of deflectors. A deflector has the following properties:
  • xmin, xmax, ymin, ymax indicates the extent of the region in which the particles are deflected.
  • kind indicates the kind of deflector. It can have the following values:
    • ps_deflect_horizontal deflects the particle horizontally; typically used for vertical walls
    • ps_deflect_vertical deflects the particle vertically; typically used for horizontal walls
  • friction the amount of friction as a result of the impact with the deflector. The higher this amount the more the particle is slowed down on impact.

The following functions are available to set the properties of the deflector. Note that each of them gets the index of the particle system to which it belongs as a first argument.

part_deflector_create(ps) Creates a new deflector in the given particle system. It returns the index of the deflector. This index must be used in all calls below to set the properties of the deflector.
part_deflector_destroy(ps,ind) Destroys deflector ind in the particle system. Call this if you don't need it anymore to save space.
part_deflector_destroy_all(ps) Destroys all deflectors in the particle system that have been created.
part_deflector_exists(ps,ind) Returns whether the indicated deflector exists in the particle system.
part_deflector_clear(ps,ind) Clears the deflector ind to its default settings.
part_deflector_region(ps,ind,xmin,xmax,ymin,ymax) Sets the region for the deflector.
part_deflector_kind(ps,ind,kind) Sets the kind for the deflector.
part_deflector_friction(ps,ind,friction) Sets the friction for the deflector.