make particles

1

Stats

2,709 visits, 4,074 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 29 Mar, 2012. Last updated 19 Feb, 2019

part one

it's very easy first insert praticles object and load any image you want and then insert mouse object and then go to event sheet the event is:mouse->on any click the action is:system create object praticles on layer 0 for X mouse.X(0) for Y mouse.Y(0) oops i forget that in praticles

object rename it star and it behaviors fade and a black tiled background

part two

let's fix our problems:

The Particles object has a relatively many properties, which are split in to three groups: particle spray properties (relating to the Particles object itself), initial particle properties (relating to the creation of each individual particle) and particle lifetime properties (relating to how particles behave after creation).

Rate

The number of particles created per second. If Type is One-shot, this is how many particles are created in total. Note that in Continuous spray mode, the overall particle count may be significantly more than the rate depending on the other properties.

Spray cone

The number of degrees through which particles are fired. This is represented by the red lines in the Layout View. Use 360 to fire particles in all directions.

Type

The Particles object can work in two modes:

Continuous spray will create a constant spray of particles (the default).

One-shot will create a single blast of particles, the total number set by Rate. Once all particles have been destroyed, the Particles object then destroys itself. This is useful for one-off effects like explosions or impacts.

Image

Click to open the Image editor to edit the particle image. Try a spot on a transparent background, or on a black background with the Additive effect.

Effect

Choose a blending effect for the particles. Additive works especially well with this object. A demo of all the effects can be found here, or see the Sprite effects.capx project in the Examples folder in Construct 2's install directory.

Initial particle properties

Speed

The initial speed each particle is fired at, in pixels per second.

Size

The initial size of each particle, in pixels. Particles are always shown as squares.

Opacity

The initial opacity of each particle, from 0 (transparent) to 100 (opaque).

Grow rate

The initial grow rate (change in size over time) for each particle, in pixels per second. 0 means the particle will always stay the same size. A positive value will make particles grow, and a negative value will make particles shrink.

X randomiser

Y randomiser

The initial offset to the particle's position. You can make particles created along a line or in a box with these properties.

Speed randomiser

A random adjustment to each particle's initial speed on creation. For example, a value of 100 will change each particle's initial speed by up to 50 pixels per second faster or slower.

Size randomiser

A random adjustment to each particle's size on creation. For example, a value of 20 will change each particle's initial size by up to 10 pixels larger or smaller.

Grow rate randomiser

A random adjustment to each particle's grow rate on creation. For example, a value of 10 will change each particle's initial grow rate by up to 5 pixels per second greater or less.

Particle lifetime properties

Acceleration

Change in particle speed over time, in pixels per second per second. A positive value will make particles speed up, and a negative value will make them slow down.

Gravity

The acceleration downwards caused by gravity, in pixels per second per second. Useful for making fountain or other falling particle effects. Set to 0 to prevent gravity having any effect on particle movement.

Angle randomiser

Maximum random change to each particle's angle during its lifetime, in degrees per second. For example, set to 0 to prevent particles ever changing direction, or set to 10 to allow particles to change up to 5 degrees left or right per second.

Speed randomiser

Maximum random change to each particle's speed during its lifetime, in pixels per second per second. For example, set to 0 to prevent the speed changing randomly, or set to 100 to allow particles to speed up or slow down by 50 pixels per second per second.

Opacity randomiser

Maximum random change to each particle's opacity during its lifetime. Useful for creating "twinkling" effects.

Destroy mode

How each particle is destroyed. There are three modes available:

Fade to invisible will fade each particle's opacity to zero over the Timeout. When the particle becomes invisible, it is destroyed.

Timeout expired simply destroys each particle after the Timeout has expired, without altering the opacity.

Particle stopped destroys each particle when its speed reaches zero. You must take care to use a negative Acceleration, or particles will never be destroyed!

Timeout

The time in seconds particles last for before being destroyed, depending on the Destroy mode.

part three

Most of the Particle object's actions and expressions simply set or get the above properties. See the above properties for a reference. The other conditions, actions and expressions not relating to the above properties are documented below.

For features in common to other objects, see Common features.

Particle conditions

Is spraying

True if the particle spray is currently enabled.

Particle actions

Set spraying

Enable or disable the spray, when in Continuous spray mode. When disabled, no new particles are created.

Particle expressions

Particle Count

The number of particles the Particles object currently has. This is important to ensure you are not creating too many particles and slowing the game down; see the Optimisation section above. Note that due to the way Construct 2 expressions work, if you have multiple Particle object instances, this will only return the particle count for one of the instances - use a For Each loop to count multiple instance's total particle count.

  • 0 Comments

Want to leave a comment? Login or Register an account!