Beginner's guide to Construct 2

Favourite 1279 favourites
Tutorial written by AshleyOriginally published on 26th, June 2011 - 50 revisions

Adding game functionality

If each event is described in as much detail as before, it's going to be quite a long tutorial. Let's make the description a little briefer for the next events. Remember, the steps to add a condition or action are:

1. Double-click to insert a new event, or click an Add action link to add an action.
2. Double-click the object the condition/action is in.
3. Double-click the condition/action you want.
4. Enter parameters, if any are needed.

From now on, events will be described as the object, followed by the condition/action, followed by any parameters. For example, the event we have just inserted could be written:

Add condition System -> Every tick
Add action Player -> Set angle towards position -> X: Mouse.X, Y: Mouse.Y

Get the player to shoot

When the player clicks, they should shoot a bullet. This can be done with the Spawn an object action in Player, which creates a new instance of an object at the same position and angle. The Bullet movement we added earlier will then make it fly out forwards. Make the following event:

Condition: Mouse -> On click -> Left clicked (the default)
Action: Player -> Spawn another object -> For Object, choose the Bullet object. For Layer, put 1 (the "Main" layer is layer 1 - remember Construct 2 counts from zero). Leave Image point as 0.

Your event should now look like this:

Ghost shooter event 2.
If you run the game, you'll notice the bullets shoot from the middle of the player, rather than from the end of the gun. Let's fix that by placing an image point at the end of the gun. (An image point is just a position on an image that you can spawn objects from.)

Right-click the player in the project or object bar and select Edit animations.

Editing the player's animations.
The image editor for the player reappears. Click the origin and image points tool:

The origin and image points tool.
...and the image points dialog opens up:

The image points dialog.
Notice the object origin appears as a red spot. That's the "hotspot" or "pivot point" of the object. If you rotate the object, it spins around the origin. We want to add another image point to represent the gun, so click the green add button. A blue point appears - that's our new image point. Left-click at the end of the player's gun to place the image point there:

Placing the image point at the end of the player's gun.
Close the image editor. Double-click the Spawn an object action we added earlier, and change the Image point to 1. (The origin is always the first image point, and remember Construct 2 counts from zero.) The event should now look like below - note it says Image point 1 now:

The edited event.
Run the game. The bullets now shoot from the end of your gun! The bullets don't do anything yet, though. Hopefully, however, you'll start to realise that once you get to grips with the event system, you can put functionality together very quickly.

Let's make the bullets kill monsters. Add the following event:

Condition: Bullet -> On collision with another object -> pick Monster.
Action: Monster -> Destroy
Action: Bullet -> Spawn another object -> Explosion, layer 1
Action: Bullet -> Destroy

The explosion effect

Run the game, and try shooting a monster. Oops, the explosion has that big black border!

Explosion with no effect
You might have predicted it'd look like that from the start, and wondered if our game was really going to end up like that! Don't worry, it won't. Click the Explosion object in either the Object bar in the bottom right, or the Project bar (which was tabbed with the layers bar). Its properties appear in the properties bar on the left. At the bottom, set its Blend mode property to Additive. Now try the game again.

Explosion with additive effect.
Why does this work? Without going in to the nuts and bolts, ordinary images are pasted on top of the screen. With the additive effect, each pixel is instead added (as in, summed) with the background pixel behind it. Black is a zero pixel value, so nothing gets added - you don't see the black background. Brighter colors add more, so appear more strongly. It's great for explosions and lighting effects.

Making monsters a little smarter

Right now the monsters just wander off the layout to the right. Let's make them a bit more interesting. First of all, let's start them at a random angle.

Condition: System -> On start of Layout
Action: Monster -> Set angle -> random(360)

Event 4 of the tutorial.
They will still wander off forever when they leave the layout, never to be seen again. Let's keep them inside. What we'll do is point them back at the player when they leave the layout. This does two things: they always stay within the layout, and if the player stands still, monsters come right for them!

Condition: Monster -> Is outside layout
Action: Monster -> Set angle toward position -> For X, Player.X - for Y, Player.Y.

Run the game. If you hang around for a while, you'll notice the monsters stay around the layout too, and they're going in all kinds of directions. It's hardly AI, but it'll do!

Now, suppose we want to have to shoot a monster five times before it dies, rather than instant death like it is at the moment. How do we do that? If we only store one "Health" counter, then once we've hit a monster five times, all the monsters will die. Instead, we need each monster to remember its own health. We can do that with instance variables.

Share and Copy this Tutorial

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


kemosabe 3,513 rep

Nice.i like it

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

I love you Ashley

Tuesday, July 12, 2011 at 4:00:10 AM
luisgmolina 8,263 rep

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

Friday, July 15, 2011 at 7:49:43 PM
Skodex 2,627 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
Dicon 2,846 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.

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

thanks a whole lot this tutorial was extremely helpful.

Thursday, July 28, 2011 at 8:36:42 AM
Mehtab 4,135 rep

awesome tutorial and awesome tool!

Saturday, July 30, 2011 at 10:45:41 AM
stufa 2,508 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
ianbrown3003 2,691 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
Ghengis 6,198 rep

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

Tuesday, September 13, 2011 at 4:13:04 AM
Ashley 194.7k 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
chrisbrobs 7,881 rep

Brilliant tutorial.

Saturday, September 24, 2011 at 11:02:10 PM
carminielloz 8,643 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.

Friday, September 30, 2011 at 6:03:17 AM
carminielloz 8,643 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.