Creating Spikes that Reduce Health
Try reloading this page, or reviewing your browser settings
This video shows how to create a special type of platform that the player character may jump through from below or fall through from above.
- Construct 2
- Level Design
- Platform Physics
About this video
- Lee Stemkoski
- First online
- 15 February 2019
- Online ISBN
- Copyright information
- © Lee Stemkoski 2019
Lee Stemkoski: We just finished adding the springboard. The next feature we’ll add are some Jump-thru Platforms. So to begin, in the layout, let’s right click and Insert a new object. This time, we’re actually not going to add a sprite. For technical reasons, I want to add a Tiled Background object, even though this is not going to be a background image. We’ll see why shortly. So click once on Tiled Background, next to the Name when inserted, we’ll call this Platform. Click on Insert.
Alright. Click to place this on the Main layer, and this is a single image. It has to be because it’s a background image. We’ll just click on the folder icon. We’re going to pick the log-bridge.png. It supposed to look like a side view of a log and press Open. All right, two little logs. When we close this, it looks like a whole bunch of logs. Remember a tiled background object repeats itself rather than stretching or shrinking. So in this case, I want to reduce the size, clicking on these surroundings squares because we are snapping to the grid. We can make this look like precisely one layer of logs. Each log is 16 by 16 pixels. And I’d like to duplicate and make a few of these. So holding down the control button while this is selected, then click and drag from the platform object to create another one, slightly above it. And again click and drag to make another slightly above that.
Now for the platform, I want to add a behavior to this. So click on Behaviors, then choose the plus icon. And there’s a behavior called Jump-thru. It allows you to jump through it from underneath. It’s almost as if it’s a solid but only from one direction. So we’ll add this behavior, then press x. So our Koala is going to be able to jump through this platform from underneath and land on top making effectively a ladder of sorts. However, we’d also like the Koala to be able to navigate downwards to fall through these as well. And that’s accomplished using another event.
So let’s go to the Event sheet and we’re going to add another event. So we’ll click on Add event. This will be a Keyboard event. Let’s choose Keyboard for the condition. Click on Next. Let’s say On key pressed for our condition. I’ll click the button. When asked to press a key, I will press the down arrow key. Seems intuitive to go down through platforms and click on OK and Done. So when the down arrow was pressed, we now need to choose our action. So we’ll click on Add action. This will be a Koala action because we want the Koala to fall through any platforms. So Koala, Next, and underneath the Platform category of actions there is a Fall through action which enables the Koala to fall through anything which is classified as a jump-thru platform. We’ll click on Done.
Now we’re ready to test. Let’s save. Back to our layout, press play. The game loads. And here’s our Koala. We can jump through. Every time we jump through, we land on the top. It says if this is a solid and when I press the down arrow key, can fall through. So it can be a way to navigate to the higher parts of the level. So we have a couple of options. You can springboard the Koala up or he can jump through platforms. Excellent. That’s our second interactive environment object.