Plugin for Godot 3
Installation
Godot 3.3+ is required for the plugin. Installation is quite simple:
- Extract the addons folder from the plugin archive.
- Move the addons folder into your project's root folder.
- Start Godot and enable the plugin in the project settings.
Usage
Importing An Effect
Save the effect you created in Pixelpart as a .ppfx file and place it in the folder of your Godot project. Then in Godot, import the effect file as a Pixelpart Effect. You usually want to set a scale value here, because effects typically appear small when imported into Godot.
Playing An Effect
In order to actually play the effect, create a new PixelpartEffect2D node in your scene (PixelpartEffect for 3D scenes) and move the imported effect asset onto the Effect field in the node's inspector window. The effect will now be played inside you game and you can use the effect node like any other CanvasItem node (Spatial node for 3D scenes).
Scripting
An effect and its particle emitters, sprites, force fields and colliders can be controlled dynamically from GDScript.
PixelpartEffect2D / PixelpartEffect
Attribute | Description |
---|---|
PixelpartEffectResource effect | The attached effect resource. |
bool playing | Whether the effect is currently playing or not. |
bool loop | Whether the effect restarts automatically after time loop_time . |
float loop_time | Time after which the effect loops (only effective if loop = true ). |
float speed | How fast the effect is being played. |
float frame_rate | At which rate the effect is simulated, in frames per second. |
bool flip_h | Whether the effect is flipped horizontally. |
bool flip_v | Whether the effect is flipped vertically. |
int billboard_mode | The billboard mode, which is used to align the effect to the camera (Disabled (0) , Enabled (1) , Enabled with fixed Y-Axis (2) ). |
Method | Description |
---|---|
play(bool p) | Starts playing the effect or pauses the effect if p = false . |
pause() | Pauses the effect. |
restart() | Restarts the effect and removes all existing particles. |
reset() | Restarts the effect, but does not remove existing particles. |
is_playing() | Returns whether the effect is currently playing or is paused. |
get_time() | Returns the time since the effect has started playing. |
get_import_scale() | Returns the scale applied to the effect resource. |
get_particle_emitter(String name) | Returns the particle emitter with the given name or null if no particle emitter with this name exists. |
get_force_field(String name) | Returns the force field with the given name or null if no force field with this name exists. |
get_collider(String name) | Returns the collider with the given name or null if no collider with this name exists. |
get_sprite(String name) | Returns the sprite with the given name or null if no sprite with this name exists. |
get_particle_emitter_by_id(int id) | Returns the particle emitter with the given id or null if no particle emitter with this id exists. |
get_sprite_by_id(int id) | Returns the sprite with the given id or null if no sprite with this id exists. |
get_force_field_by_id(int id) | Returns the force field with the given id or null if no field field with this id exists. |
get_collider_by_id(int id) | Returns the collider with the given id or null if no collider with this id exists. |
get_particle_emitter_by_index(int index) | Returns the particle emitter at the given index, starting with 0, or null if no particle emitter exists at this index. |
get_sprite_by_index(int index) | Returns the sprite at the given index, starting with 0, or null if no sprite exists at this index. |
get_force_field_by_index(int index) | Returns the force field at the given index, starting with 0, or null if no force field exists at this index. |
get_collider_by_index(int index) | Returns the collider at the given index, starting with 0, or null if no collider exists at this index. |
PixelpartParticleEmitter
Attribute | Description |
---|---|
float lifetime_start | When the emitter becomes active, in seconds. |
float lifetime_duration | How long the emitter stays active, in seconds. |
bool repeat | Whether the emitter continues to stay active after lifetime_duration has passed. |
int shape | Shape of the emitter area (POINT , LINE , ELLIPSE , RECTANGLE , PATH ). |
int distribution | How particles are distributed in the emitter area (UNIFORM , CENTER , CENTER_REVERSE , BOUNDARY ). |
int spawn_mode | In which direction particles are generated in relation to the emitter area (FIXED , OUT , IN ). |
int instantiation_mode | How particles are created over the lifetime of the emitter (CONTINUOUS , BURST , BURST_DEATH ). |
int layer | Layer on which the particles of the emitter are drawn, starting at 0. |
bool visible | Whether the emitter and its particles are visible. |
int particle_rotation_mode | The rotation mode of particles (ANGLE , VELOCITY , ALIGN , ALIGN_PATH ). |
float particle_lifespan_variance | How much the lifespans of particles vary. |
float particle_initial_velocity_variance | How much the starting velocities of particles vary. |
float particle_rotation_variance | How much the rotations of particles vary. |
float particle_angular_velocity_variance | How much the angular velocities of particles vary. |
float particle_size_variance | How much the sizes of particles vary. |
float particle_opacity_variance | How much the opacities of particles vary. |
Method | Description |
---|---|
get_name() | Returns the name of the emitter. |
get_id() | Returns the id of the emitter. |
get_parent_id() | Returns the id of the emitter's parent. |
is_active() | Returns whether the emitter is active and spawns particles at the current point in time. |
get_local_time() | Returns the time fraction the emitter has been active for, in range 0.0 (0%) to 1.0 (100%). |
spawn_particles(int count) | Spawns count particles using the emitter. |
get_shape_path() | Returns the spawn path of the emitter if PATH is selected as the emitter shape. |
get_width() | Returns the curve describing the width of the emitter area. |
get_height() | Returns the curve describing the height of the emitter area. |
get_orientation() | Returns the curve describing the orientation of the emitter area in degrees. |
get_direction() | Returns the curve describing the direction of the emitter in degrees. |
get_spread() | Returns the curve describing the spread of the emitter. |
get_num_particles() | Returns the curve describing the number of the particles the emitter spawns per second. |
get_particle_lifespan() | Returns the curve describing the lifespan of particles of the emitter. |
get_motion_path() | Returns the motion path of the emitter. |
get_particle_motion_path() | Returns the motion path of particles of the emitter. |
get_particle_initial_velocity() | Returns the curve describing the starting velocity of particles of the emitter. |
get_particle_acceleration() | Returns the curve describing the acceleration of particles over their lifetime. |
get_particle_radial_acceleration() | Returns the curve describing the radial acceleration of particles over their lifetime. |
get_particle_damping() | Returns the curve describing the damping of particles over their lifetime. |
get_particle_initial_rotation() | Returns the curve describing the starting rotation of particles. |
get_particle_rotation() | Returns the curve describing the rotation of particles over their lifetime. |
get_particle_weight() | Returns the curve describing the weight of particles over their lifetime. |
get_particle_bounce() | Returns the curve describing the bounce of particles over their lifetime. |
get_particle_friction() | Returns the curve describing the friction of particles over their lifetime. |
get_particle_initial_size() | Returns the curve describing the starting size of particles. |
get_particle_size() | Returns the curve describing the size of particles over their lifetime. |
get_particle_width() | Returns the curve describing the width of particles over their lifetime. |
get_particle_height() | Returns the curve describing the height of particles over their lifetime. |
get_particle_color() | Returns the gradient describing the colors of particles over their lifetime. |
get_particle_initial_opacity() | Returns the curve describing the initial opacity of particles. |
get_particle_opacity() | Returns the curve describing the opacity of particles over their lifetime. |
PixelpartSprite
Attribute | Description |
---|---|
float lifetime_start | When the sprite becomes active, in seconds. |
float lifetime_duration | How long the sprite stays active, in seconds. |
bool repeat | Whether the sprite continues to stay active after lifetime_duration has passed. |
bool align_with_path | Whether the sprite's orientation aligns with the motion path. |
Vector2 pivot | The point around which the sprite rotates, relative to the sprite center. |
int layer | Layer on which the sprite is draw, starting at 0. |
bool visible | Whether the sprite is visible. |
Method | Description |
---|---|
get_name() | Returns the name of the sprite. |
get_id() | Returns the id of the sprite. |
is_active() | Returns whether the sprite is active. |
get_local_time() | Returns the time fraction the sprite has been active for, in range 0.0 (0%) to 1.0 (100%). |
get_width() | Returns the curve describing the width of the sprite. |
get_height() | Returns the curve describing the height of the sprite. |
get_orientation() | Returns the curve describing the orientation of the sprite in degrees. |
get_motion_path() | Returns the motion path of the sprite. |
get_color() | Returns the color gradient of the sprite. |
get_opacity() | Returns the curve describing the opacity of the sprite. |
PixelpartForceField
Attribute | Description |
---|---|
float lifetime_start | When the force field becomes active, in seconds. |
float lifetime_duration | How long the force field stays active, in seconds. |
bool repeat | Whether the force field continues to stay active after lifetime_duration has passed. |
int type | Type of the force field (POINT , AREA ). |
float direction_variance | How much the force direction is allowed to vary between grid cells of the force field. |
float strength_variance | How much the force strength is allowed to vary between grid cells of the force field. |
Method | Description |
---|---|
get_name() | Returns the name of the force field. |
get_id() | Returns the id of the force field. |
is_active() | Returns whether the force field is active. |
get_local_time() | Returns the time fraction the force field has been active for, in range 0.0 (0%) to 1.0 (100%). |
set_grid_size(int width, int height) | Sets the number of columns and rows of the force field grid. Each cell of the grid varies in direction and strength determined by direction_variance and strength_variance . |
get_grid_width() | Returns the number of columns of the force field grid. |
get_grid_height() | Returns the number of rows of the force field grid. |
get_width() | Returns the curve describing the width of the force field. |
get_height() | Returns the curve describing the height of the area force field. |
get_orientation() | Returns the curve describing the orientation of the area force field. |
get_motion_path() | Returns the motion path of the force field. |
get_direction() | Returns the curve describing the force direction of the area force field. |
get_strength() | Returns the curve describing the strength of the force field. |
PixelpartCollider
Attribute | Description |
---|---|
float lifetime_start | When the collider becomes active, in seconds. |
float lifetime_duration | How long the collider stays active, in seconds. |
bool repeat | Whether the collider continues to stay active after lifetime_duration has passed. |
Method | Description |
---|---|
get_name() | Returns the name of the collider. |
get_id() | Returns the id of the collider. |
is_active() | Returns whether the collider is active. |
get_local_time() | Returns the time fraction the collider has been active for, in range 0.0 (0%) to 1.0 (100%). |
add_point(Vector2 point) | Adds a vertex to the collider at the given position. |
set_point(int index, Vector2 point) | Sets the position of the given vertex. |
remove_point(int index) | Removes the given vertex from the collider. |
get_point(int index) | Returns the position of the given vertex. |
get_num_points() | Returns the number of vertices. |
get_bounce() | Returns the curve describing the bounce of the collider. |
get_friction() | Returns the curve describing the friction of the collider. |
PixelpartCurve
Attribute | Description |
---|---|
int interpolation | Interpolation applied to the curve (NONE , LINEAR , SPLINE ). |
Method | Description |
---|---|
get(float t) | Returns the (interpolated) value of the curve at time t (in range 0.0 to 1.0 ) |
get_point(int index) | Returns the value of the curve point with the given index. |
set(float value) | Sets the curve to a constant with value value . |
add_point(float t, float value) | Adds a curve point at time t with value value . |
set_point(int index, float value) | Sets the value of the curve point with the given index to value . |
move_point(int index, float delta) | Adds delta to the value of the curve point with the given index. |
shift_point(int index, float delta) | Moves the curve point with the given index forward or backward in time by delta . |
remove_point(int index) | Removes the point with the given index from the curve. |
clear() | Removes all points from the curve. |
get_num_points() | Returns the number of curve points. |
move(float delta) | Adds delta to the value of all curve points. |
shift(float delta) | Moves all curve points forward or backward in time by delta . |
enable_adaptive_cache() | Enables an adaptive cache, which resizes itself automatically if the number of curve points increases or decreases a lot. |
enable_fixed_cache(int size) | Enables a fixed cache with the given size, which only stores up to size different values. |
get_cache_size() | Returns the size of the cache. |
PixelpartPath
Attribute | Description |
---|---|
int interpolation | Interpolation applied to the path (NONE , LINEAR , SPLINE ). |
Method | Description |
---|---|
get(float t) | Returns the (interpolated) path point at time t (in range 0.0 to 1.0 ). |
get_point(int index) | Returns the path point with the given index. |
set(Vector2 value) | Sets the path to a constant point with position value . |
add_point(float t, Vector2 value) | Adds a path point at time t with position value . |
set_point(int index, Vector2 value) | Sets the position of the path point with the given index to value . |
move_point(int index, Vector2 delta) | Adds delta to the position of the point with the given index. |
shift_point(int index, float delta) | Moves the point with the given index forward or backward in time by delta . |
remove_point(int index) | Removes the point with the given index from the path. |
clear() | Removes all points from the path. |
get_num_points() | Returns the number of path points. |
move(Vector2 delta) | Adds delta to the position of all path points. |
shift(float delta) | Moves all path points forward or backward in time by delta . |
enable_adaptive_cache() | Enables an adaptive cache, which resizes itself automatically if the number of path points increases or decreases a lot. |
enable_fixed_cache(int size) | Enables a fixed cache with the given size, which only stores up to size different values. |
get_cache_size() | Returns the size of the cache. |
PixelpartGradient
Attribute | Description |
---|---|
int interpolation | Interpolation applied to the gradient (NONE , LINEAR , SPLINE ). |
Method | Description |
---|---|
get(float t) | Returns the (interpolated) gradient color at time t (in range 0.0 to 1.0 ). |
get_point(int index) | Returns the color of the gradient mark with the given index. |
set(Color value) | Sets the gradient to the constant color value . |
add_point(float t, Color value) | Adds a gradient mark at time t with color value . |
set_point(int index, Color value) | Sets the color of the gradient mark with the given index to value . |
move_point(int index, Color delta) | Adds delta to the color of the gradient mark with the given index. |
shift_point(int index, float delta) | Moves the gradient mark with the given index forward or backward in time by delta . |
remove_point(int index) | Removes the gradient mark with the given index from the gradient. |
clear() | Removes all marks from the gradient. |
get_num_points() | Returns the number of gradient marks. |
move(Color delta) | Adds delta to the color of all gradient marks. |
shift(float delta) | Moves all gradient marks forward or backward in time by delta . |
enable_adaptive_cache() | Enables an adaptive cache, which resizes itself automatically if the number of gradient marks increases or decreases a lot. |
enable_fixed_cache(int size) | Enables a fixed cache with the given size, which only stores up to size different values. |
get_cache_size() | Returns the size of the cache. |
Platform Support
Platforms | Architectures | Supported |
---|---|---|
Windows | x64, x86 | |
Linux | x64, x86 | |
macOS | Universal | |
Android | ||
iOS | ||
HTML5 | ||
Console |