![]() |
Pixelpart 1.10.0
GameMaker Plugin
|
A Pixelpart effect can be controlled and modified at runtime with a GML script. This can be used to dynamically make an effect react to what is happening in your game.
The obj_PixelpartEffect object provides methods and properties to start, pause and restart the effect simulation. You can also change the object variables from a script. The PixelpartEffect struct provides similar methods and properties.
effect_loop_time.effect_loop is enabled.effect_speed to 0.5 shows the effect in slow motion.effect_random_seed is not enabled.The following example illustrates how to start playing an effect in slow-motion:
You might also want to get notified when an effect is finished and no particles are visible anymore. You can do so by subscribing to finished_event. Of course this only works for effects without repeating emitters.
Effect inputs are the primary technique to dynamically modify effect properties. The following example shows how the value of an effect input that has been defined in the Pixelpart editor can be changed with GML.
Depending on the data type, several set methods are available to change the value of effect inputs:
To retrieve the currently set input value, use the corresponding get methods:
These method are available for the obj_PixelpartEffect object as well as the PixelpartEffect struct.
Triggers are used to make effects react to events in your game. The following example shows how a trigger can be activated with GML using the activate_trigger method:
To check if a trigger has already been activated, use is_trigger_activated. These method are available for the obj_PixelpartEffect object as well as the PixelpartEffect struct.
In contrast to triggers, events are used to make the game react to something happening in the effect, for example to play an audio clip when an emitter starts producing particles. You can subscribe to effect_event to get notified when effect events occur:
The effect_event is available for the obj_PixelpartEffect object as well as the PixelpartEffect struct.