Platform-Style Video Games with Construct

Adding Behaviors

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 add behaviors to objects, which implement frequently needed functionality in video games.


  • Construct 2
  • Sprite
  • Behaviors

About this video

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

Video Transcript

Lee Stemkoski: To add some functionality to our Koala, there’s two ways you can do that. For very commonly needed functionality in video games, you can add things called Behaviors. So for example, my Koala does some pretty standard platform game behaviors such as walking from side to side and jumping. So with my Koala selected at that blue box around it, I’m going to go look at the properties of the Koala. And in this list, you’ll see a blue underlined word called Behaviors. Go ahead and click on that. A window will appear with a list of attached behaviors. It’s currently empty because we’ve added none. Click that plus icon. You’ll see a large list of behaviors which opens up. We want to choose the Platform behavior. It’s under the Movement categories towards the bottom. And you’ll notice it says jump and run between platforms. That is to say solid objects. So we’ll add that behavior to our Koala.

It appears in the list and we can close this. Actually no. Before we close this, we’ll add one more behavior as well. Since it’s a large level, we want to keep the camera focused on the Koala at all times. So adding a second behavior under the General category, we’ll add Scroll To. This refers to the camera. It will always stay centered on our Koala. So add that behavior as well. Now with these two behaviors, we can close that.

Finally, we need to declare which objects are solids. The easiest way to do this is in the lower right-hand panel, which might still feature the tilemap. Click on the tab on the left which says Objects to get a list of all the objects in our game. Click on the Tilemap object and then you’ll notice the tilemaps highlighted in blue and the Properties panel on the left changes to give us properties of the tilemap. Click on Behaviors and we’ll add a behavior to that by clicking on the plus icon. We’ll add the behavior of Solid. The tilemap won’t do anything but other behaviors which interacts with solid objects will recognize that every tile on the tilemap should be treated as a solid. Click on Add. We’ll see Solid appears in this list and we’ll click the x button.

All right, we’re ready to test the game. So let’s save our game. So it’s good to save. And then we’re going to press the run layout icon in the top. It looks like a little play icon, a right facing triangle. This will open up a web browser. We’ll be able to play our game in that browser. Now the default controls. Use the left and right arrow keys to move our Koala to the left and right and use the up arrow key to jump. So right now, our Koala can move. It looks like it’s sliding across the level. It’s going a little bit fast. We can change some behaviors to fix that. We also need to add some customized events to get the Koala to activate the correct animations. And finally, using the up arrow key to jump feels a little bit unintuitive to me. So we’ll also add some customized keyboard controls. I’d rather use, for instance, the J key to jump.

So let’s go ahead and close this web browser. Returning to Construct 2, we’re going to start adding some events, but first, we need to add a keyboard object. This enables us to access keyboard at conditions in our event sheet. So in the layout, go ahead and right click, Insert a New Object and that list of objects under the Input category. Let’s select the Keyboard. Don’t really need to rename the keyboard, just choose the Insert button. Nothing appears on the screen, but the keyboard is now available to the entire project.