Platform-Style Video Games with Construct

Creating a Brick that can be Destroyed

Your browser needs to be JavaScript capable to view this video

Try reloading this page, or reviewing your browser settings

This video shows how to create a solid object that can be destroyed when hit by the character from below.


  • Construct 2
  • Sprites
  • Events

About this video

Lee Stemkoski
First online
15 February 2019
Online ISBN
Copyright information
© Lee Stemkoski 2019

Video Transcript

Lee Stemkoski: In this video, we’ll create a new kind of object. It’s not exactly a collectible item and it’s also not a permanent part of the environment. These will be bricks that the Koala can destroy by jumping into them from below. And as they’re destroyed, we don’t simply want them to disappear, we’ll introduce something called a Particle Effect, which is a series of small images which can simulate something. In this case, we want to simulate fragments of bricks falling apart, but Particle Effects could also be used for explosions or fire or fireworks, things like that. So we’ll be introduced to them in this video.

To begin, let’s open up our code from last time. Here’s our project, and we’re going to jump right in and create a new object, a brick. I need some space to test, so I’m going to take some of these other objects, these platforms. I’m going to move them out of the way. In fact, I might just delete them. I can right click and delete each one. Again, with my mouse over the layout, I’ll right click and Insert a new object. Click once on Sprite, enter the name Brick and Insert.

This is just a single image, so I’ll click on the folder icon at the top and choose brick.png. I also want to adjust the collision polygon, so clicking on that icon here, I’d like the brick to be treated as a rectangle. So I’ll right click and choose Set to bounding box. I’m all done. Click on the red x to close. That brick’s a little bit large. So I’ll shrink it until it’s about half the size it was before, approximately the same size as our other objects. I’d also like to make a few copies of this brick. So with the brick selected, holding down control, clicking and drag to make more copies of bricks. Excellent.

Next, I’d like to add the behavior of solid to the bricks. So with a brick selected, in the Properties panel, click on the underlined blue word Behaviors and we will add the behavior Solid. Finally, we need a way to interact with these bricks, so when we collide with them from below, we’ll have the bricks disappear. Let’s go to the Event sheet and we’ll add an event. This will be an event, a Koala event, Koala condition. Scroll down and I’d like to choose in Collisions, On collision with another object. Click to choose the Brick object.

I actually need a second condition as well. I don’t want the bricks to be destroyed if I jump on top of them only if I jumped underneath them, so I need to check that the Koala has collided with a brick and that it’s coming from below. In order to do this, we’ll add a second condition. Let’s right click on this condition. From the menu, select Add another condition, and this will be another Koala condition. Now, underneath the Collisions category, I’d like to check if it’s overlapping from below. The Koala won’t be overlapping the object exactly. Collision is the moment before it overlaps an object. So I’m going to check if the Koala Is overlapping at an offset. That means if I were to shift to the Koala by some amount, would there be an overlap?

So in this case, the object, I’ll click to choose a Brick. And under Offset Y, I want to see if the brick is above us. So I’ll check to see if the brick is overlapping, say at negative 10 pixels. That is to say if you were to move the Koala up by 10 pixels, would it be overlapping a brick and that is sufficient to check if the Koala is colliding with a brick from below. Click on Done. And now we need to add an action. This action is going to be to destroy the brick. So brick will be destroyed. Maybe as an added bonus for the player, there might be a coin underneath this brick. So let’s add a second action. We’ll have the brick spawn a coin. So Brick action, under Miscellaneous category, choose Spawn another object, then click the button to choose a Coin. And we’ll spawn that on the Main layer. Excellent.

We’re ready to save and test. We’ll save. Press the play button, the web browser open so we can preview our game. Now I’ll take my Koala and jump into a brick from underneath, and sure enough, a brick disappears, and coins appear in their spot. Also, important to note, if I land on the bricks from above, they don’t disappear. It only works if I’m above the brick. Excellent. Now we’d like to add a special effect to make the brick look like it’s shattering into fragments when we collide with it.