08.11.2012 Views

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Attractors<br />

Besides emitters a particle system can also contain attractors. An attractor attracts the<br />

particles (or pushes them away). A particle system can have multiple attractors. You are<br />

though recommended to use few of these because they will slow down the processing of the<br />

particles. An attractor has the following properties:<br />

• x,y indicate the position of the attractor.<br />

• force indicates the attracting force of the attractor. How the force acts on the<br />

particles depends on the following parameters.<br />

• dist indicates the maximal distance at which the attractor has effect. Only particles<br />

closer that this distance to the attractor will be attracted.<br />

• kind indicates the kind of attractor. The following values exist<br />

o ps_force_constant indicates that the force is constant independent of the<br />

distance.<br />

o ps_force_linear indicates a linearly growing force. At the maximal distance<br />

the force is 0 while at the position of the attractor it attains the given value.<br />

o ps_force_quadratic indicates that the force grows quadratic.<br />

• additive indicates whether the force is added to the speed and direction in each step<br />

(true) or only applied to the position of the particle (false). When additive the particle<br />

will accelerate towards the attractor while <strong>with</strong> a non-additive force it will move there<br />

<strong>with</strong> constant speed.<br />

The following functions exist to define attractors. Note that each of them gets the index of the<br />

particle system to which it belongs as a first argument.<br />

part_attractor_create(ps) Creates a new attractor in the given particle<br />

system. It returns the index of the attractor. This index must be used in all<br />

calls below to set the properties of the attractor.<br />

part_attractor_destroy(ps,ind) Destroys attractor ind in the particle<br />

system. Call this if you don't need it anymore to save space.<br />

part_attractor_destroy_all(ps) Destroys all attractors in the particle<br />

system that have been created.<br />

part_attractor_exists(ps,ind) Returns whether the indicated attractor<br />

exists in the particle system.<br />

part_attractor_clear(ps,ind) Clears the attractor ind to its default

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!