Beginner's guide to Construct 2

Favourite 625 favourites
Tutorial written by AshleyOriginally published on 26th, June 2011 - 48 revisions

Events

First, click the Event sheet 1 tab at the top to switch to the Event sheet editor. A list of events is called an Event sheet, and you can have different event sheets for different parts of your game, or for organisation. Event sheets can also "include" other event sheets, allowing you to reuse events on multiple levels for example, but we won't need that right now.

The Event Sheet tab.

About events

As the text in the empty sheet indicates, Construct 2 runs everything in the event sheet once per tick. Most monitors update their display 60 times per second, so Construct 2 will try to match that for the smoothest display. This means the event sheet is usually run 60 times per second, each time followed by redrawing the screen. That's what a tick is - one unit of "run the events then draw the screen".

Events run top-to-bottom, so events at the top of the event sheet are run first.

Conditions, actions and sub-events

Events consist of conditions, which test if certain criteria are met, e.g. "Is spacebar down?". If all these conditions are met, the event's actions are all run, e.g. "Create a bullet object". After the actions have run, any sub-events are also run - these can then test more conditions, then run more actions, then more sub-events, and so on. Using this system, we can build sophisticated functionality for our games and apps. We won't need sub-events in this tutorial, though.

Let's go over that again. In short, an event basically runs like this:

Are all conditions met?
---> Yes: run all the event's actions.
---> No: go to next event (not including any sub-events).

That's a bit of an oversimplification. Construct 2 provides a lot of event features to cover lots of different things you might need to do. However, for now, that's a good way to think about it.

Your first event

We want to make the player always look at the mouse. It will look like this when we're done:

The completed event.
Remember a tick runs every time the screen is drawn, so if we make the player face the mouse every tick, they'll always appear to be facing the mouse.

Let's start making this event. Double-click a space in the event sheet. This will prompt us to add a condition for the new event.

The New Event dialog.
Different objects have different conditions and actions depending on what they can do. There's also the System object, which represents Construct 2's built-in functionality. Double-click the System object as shown. The dialog will then list all of the System object's conditions:

Choosing 'Every tick'.
Double-click the Every tick condition to insert it. The dialog will close and the event is created, with no actions. It should now look like this:

The empty 'Every tick' event.
Now we want to add an action to make the player look at the mouse. Click the Add action link to the right of the event. (Make sure you get the Add action link, not the Add event link underneath it which will add a whole different event again.) The Add Action dialog will appear:

The Add Action dialog.
As with adding an event, we have our same list of objects to choose from, but this time for adding an action. Try not to get confused between adding conditions and adding actions! As shown, double-click the Player object, for it is the player we want to look at the mouse. The list of actions available in the Player object appears:

Player 'Set angle towards position' action.
Notice how the player's 8-direction movement behavior has its own actions. We don't need to worry about that for now, though.

Rather than set the player's angle to a number of degrees, it's convenient to use the Set angle towards position action. This will automatically calculate the angle from the player to the given X and Y co-ordinate, then set the object's angle to that. Double-click the Set angle towards position action.

Construct 2 now needs to know the X and Y co-ordinate to point the player at:

Set angle towards position parameters.
These are called the parameters of the action. Conditions can have parameters too, but Every tick doesn't need any.

We want to set the angle towards the mouse position. The Mouse object can provide this. Enter Mouse.X for X, and Mouse.Y for Y. These are called expressions. They're like sums that are calculated. For example, you could also enter Mouse.X + 100 or sin(Mouse.Y) (although those particular examples might not be very useful!). This way you can use any data from any object, or any calculation, to work out parameters in actions and conditions. It's very powerful, and a sort of hidden source of much of Construct 2's flexibility.

Did you get an error that said "Mouse is not an object name"? Make sure you added the Mouse object! Go back to page 2 and check under "Add the input objects".

You might be wondering how you'd remember all the possible expressions you could enter. Luckily, there's the "object panel" which you should see floating above it. By default, it's faded out so it doesn't distract you.

The object panel.
Hover the mouse over it, or click on it, and it'll become fully visible. This serves as a sort of dictionary of all the expressions you can use, with descriptions, to help you remember. If you double-click an object, you'll see all its expressions listed. If you double-click an expression, it will also insert it for you, saving you from having to type it out.

Anyway, click Done on the parameters dialog. The action is added! As you saw before, it should look like this:

The completed event.
There's your first event! Try running the game, and the player should now be able to move around as before, but always facing the mouse. This is our first bit of custom functionality.

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.

Comments

48
kemosabe 2,531 rep

Nice.i like it

Thursday, June 30, 2011 at 10:42:49 AM
24
ludodesign 22.5k rep
Saturday, July 02, 2011 at 3:26:03 AM
16
ludodesign 22.5k rep

I love you Ashley

Tuesday, July 12, 2011 at 4:00:10 AM
30
luisgmolina 6,436 rep

Very cool.
we need a advanced tutorial now, please.
thank you.

Friday, July 15, 2011 at 7:49:43 PM
17
Skodex 2,362 rep

Thanks for this. You made something which I first thought to be rather complicated, seem extremely easy.

Monday, July 25, 2011 at 6:14:40 PM
14
Dicon 2,498 rep

A great tutorial and not too difficult to get your head around. Are there any books out there for Construct? We all need them.
Thank.
Dicon

Wednesday, July 27, 2011 at 12:08:49 PM
12
driftish 2,312 rep

thanks a whole lot this tutorial was extremely helpful.

Thursday, July 28, 2011 at 8:36:42 AM
13
Mehtab 3,074 rep

awesome tutorial and awesome tool!

Saturday, July 30, 2011 at 10:45:41 AM
9
stufa 2,281 rep

I love it!!!
I've always wanted to create a video game. Your tutorial was clear and interesting. You make a great teacher Mr Ashley.

Oh I tried running your additional tutorial on Ghost Shooter. For some reason I can't run the demo play.

I'm afraid I'm quite a computer noob.

Saturday, August 06, 2011 at 12:14:18 PM
15
ianbrown3003 2,466 rep

This is great! I've just started a games designer course, and although I get a full version of Gamemaker at some point during the course, I wanted to get hands on with using game-making software now...this program looks great, and your beginners guide has eased me in really well, it's well written and very user-friendly. Top work!

You've inspired me to play around more with this program, and that means I'll probably end up buying the full version soon. Good work!

Friday, September 09, 2011 at 9:27:08 PM
11
Ghengis 4,633 rep

This is a must read. Excellent overview of how Construct 2 works.

Tuesday, September 13, 2011 at 4:13:04 AM
15
Ashley 112.1k rep

Just made an update: the tutorial now covers image points (added in r56). It's on page 5.

Saturday, September 17, 2011 at 5:48:10 PM
10
chrisbrobs 6,470 rep

Brilliant tutorial.

Saturday, September 24, 2011 at 11:02:10 PM
9
carminielloz 8,401 rep

oh my Gosh !!! this is amazing , thank you guys !!!!
I only just finished page 1 but I love it
the possibilities to creat a variety of videogames seem endless.
THANK YOU VERY MUCH GUYS !!!

Friday, September 30, 2011 at 6:03:17 AM
9
carminielloz 8,401 rep

my hero moves nicely ( 8 direction , bound to lay out and scroll to )
but i think i missed something , the monster doesn t move , i changed the speed but it never moved in the first place ( i gave him bullet movement but nothing )

Friday, September 30, 2011 at 6:34:29 AM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.