Key and Lock Mechanics
Try reloading this page, or reviewing your browser settings
This video shows how to create a particle effect to visually simulate a brick shattering into fragments.
- Construct 2
- Particle Effects
About this video
- Lee Stemkoski
- First online
- 15 February 2019
- Online ISBN
- Copyright information
- © Lee Stemkoski 2019
Lee Stemkoski: To add a special effect, first, let’s close the Preview browser and let’s go back to the layout. We’re going to introduce a new type of object called a Particle object. Let’s right click on the layout. Insert a new object. We’ll click once on Particles. It’s very useful for visual effects. It’s very useful for visual effects. Click on that once and for the name, let’s type Fragments. So we’ll look like brick fragments. Click to place this somewhere. And this is based off of a single image. So we’ll click on the folder and we’ll choose the image called fragment.png.
Now a particle object will create lots of copies of this image potentially moving in different ways, following different paths. This is one of the more complicated objects in Construct to learn how to use because it has so many properties. But by experimenting and learning how to use it, you can create some really cool effects. So once the image is loaded, I want to close this and I’m going to go over to the Properties panel.
First, I want to change the type. We’re not gonna keep on spraying out bricks forever, so we’re going to change the type from Continuous spray to One-shot. It means we’ll have a burst of small images of bricks. When the type is One-shot, the rate explains how many images will be produced. I’ll change that number to 6. The Spray cone is the variability in the angle that they will be shot at. You rotate this, so perhaps I want the bricks to spray out a little bit further to the left and to the right. I’ll change the property Spray cone from 60 degrees to 120 degrees. Notice those red lines are now spread out so the brick fragments could potentially go farther in each direction.
In addition, I’ll change a few other properties. For example, I want the bricks to move a little bit faster initially, so I’ll change speed from 200 to 300. The size of the bricks is a little bit smaller than 32 pixels by 32 pixels, so I’ll change the property size from 32 to 16. Also, the particles will not be accelerating, so I’ll change the acceleration property to 0. I would also like to add gravity, so they’re pulled down towards the ground. I’ll change that to 1500. The destroy mode, I don’t want the bricks to fade out, so when time runs out on each image, I’d like them to just be destroyed. I’ll change Destroy mode to Timeout expired. And finally, timeout is how many seconds each small image will exist. I’ll change that to 3.
With all these properties changed, the last thing I want to do is move this initial effect off of the layout. I don’t want to see bricks exploding when the game starts, so I’m going to move it into the margin area far below. Now let’s go to the Event sheet so we can trigger the effect when the bricks are destroyed. Click on Event sheet. And in the event we just created, we’re going to add two more actions. First, the brick will also spawn some fragments. So the next action is a Brick action. In the Miscellaneous category, choose Spawn another object. That object will be a Fragments particle object. We’ll put that on the Main layer. And finally, I need to make sure that the fragments are initially rotated so they’re firing up. So add one more action. This will be to rotate the fragments so they’re facing up at an angle of 270 degrees. So this final action is a Fragments action, under Angle, we’ll set angle. We’ll change that number to 270 degrees.
That’s all we need for an event. Let’s save our work, go back to the layout and give this a test. And now whenever we jump into the bricks, it should appear as though it’s shattering, and little pieces fly out. Excellent. Well, that completes our Particle Effect and we’ll continue to add features in the next video.