How to build a basic top down shooting game in Construct 2

Favourite 6 favourites
Tutorial written by SciFiStudiosOriginally published on 7th, November 2012 - 16 revisions

Building pretty (destructive) things.

NOTE: This tutorial is written under the assumption you already have downloaded Construct 2. In this tutorial I will be showing you how to build and design a basic top-down game using Construct 2.

Starting off and the first sprites

To start, open up a new file and add these 4 sprites. Make a player sprite and give it the 8 direction movement. Once you've done that make a second sprite and give it bullet movement (make sure to bring it's speed down a bit... If you dont it will race across the map like a, bullet)
Build a third sprite and give it the "Pin Ability." The fourth and final sprite will also have the pin ability. I've added a player image you could use below, BUT I strongly advise making your own images.)


You can make the player and enemy sprites out of the same images (NOTE: that the player already has a gun so you don't have to make a gun sprite in this case all you have to do is set the image point and change the spawn object action, Disregard any text about the gun sprite as it will not apply to you.)

Now name the sprites accordingly:
Sprite: Player
Sprite2: Enemy
Sprite3: PlayerGun
Sprite4: EnemyGun

Now draw what you think each of these should look like (Be creative and draw what you think the sprites should look like) Once you do that Put the player on one side of the map and the enemy on the other, then put the gun where the hands you drew on the player are. Same for the enemy.

The all powerful event sheet

Open up the events sheet now. You'll need to do 2 things, Make the event "On Start of layout" and give it the actions " Pin Gun to Player position and angle" and Pin EnemyGun to Enemy" After that add the global variable "Health" and "EnemyHealth" and assign them both values of 100.

Next add the event "Every tick" and the actions "Set Player angle to position, Mouse.X Mouse.Y" Once you have that Run the game and see what happens. If your character moves around and points to the mouse then your on the right track, else go over the events you have and figure out what you did wrong.

They're alive!!

Now we will make your character shoot and the enemy follow you around. This is pretty simple to do, simply use the same action we used to make the player follow the mouse but switch the " Mouse.X and Mouse.Y to Player.X and Player.Y and put it under the event "Every tick". and run the program again. Your player should now be getting stalked by the enemy.

Designing your weapons

To make it shoot just make a sprite, give it bullet movement, and destroy outside of layout, name it bullet, and make it look like a bullet. Add the "Mouse" object to the game and make a new event. "On left button clicked" then add the action "Gun spawn another object, Bullet" This will now allow your character to shoot but the bullets still don't do anything.

Here is a good image I picked up from a demo game.


Now add the events "Bullet on collision with enemy" and give it the action "Subtract 5 from EnemyHealth" and "Destroy Bullet" Now make the event "EnemyHealth <= 0" and give it the action "Destroy Enemy"

Test drive

Run the game and now you can destroy your enemy after you shoot it 20 times. Now add the event "Every 1.0 seconds" and give it the action "EnemyGun spawn another object, Bullet" and the enemy will shoot back at you. Run it again and test the game, try to destroy the enemy and see what happens. You may realize that the enemy can shoot you all he wants but the bullets just pass harmlessly through you.

Getting hurt

This is easy to do. Just take the "Bullet on collision with" event, and copy/paste it then tell it to affect the player instead of the enemy. (Ex. Subtract 5 from Health instead of EnemyHealth)
do the same with the "EnemyHealth <= 0" event and it's actions and reverse it to affect the player and there you go, your first fighting game. From here you can add solid walls, respawning enemies and a Game over and title screen. The sky (or your edition) is the limit!.

The finished masterpiece (sort of)

If all goes well and your computer doesn't spontaneously combust, the game should look a little like this. Notice I've added a simple background color, you can make it whatever you want but I've chosen green.

Comments

3
Cpryd001 4,236 rep

This is not really what a fighting game is. Fighting games are like Street Fighter or Tekken. What you're describing seems more like a 2D run-and-gun death match. Break your tutorial into smaller steps And throw a fee pictures in there. It looks really good, but it a little too wordy for a new user.

Friday, November 09, 2012 at 5:43:42 AM
0
SciFiStudios 3,240 rep

Thanks for the advise, this is my first tutorial. And I guess that mine is more of a 2-d run and gun deathmatch but it still would fall under action or fighting games at a game website.

Friday, November 09, 2012 at 1:12:00 PM
0
SciFiStudios 3,240 rep

And you are right it is a tad to bland.

Friday, November 09, 2012 at 1:19:15 PM
1
vivekdx 2,478 rep

Good try man. Give us a fighting game like mortal combat next time. this is Duel or Shooting game

Saturday, November 10, 2012 at 10:34:38 AM
0
SciFiStudios 3,240 rep

Well even that isn't to hard. Give your guy platform and make a separate sprite for the arms, give the arms pin and get them to set angle to mouse then make a weapon and pin them to the arms.

Saturday, November 10, 2012 at 4:19:16 PM
-2
SaCoderz 2,588 rep

Umm My comment? read some of the favorited tutorials to see how to do it right

Wednesday, November 28, 2012 at 12:50:49 PM
0
SciFiStudios 3,240 rep

Just to let you guys know. I am open for suggestions like Crpyd001's comment. Not criticism.

Friday, November 30, 2012 at 5:11:20 PM
0
Crash159 635 rep

This tutorial needs an update, the way of making the enemies die with the health variable doesn't work anymore, it just kills all the enemies at once, now you have to add a subevent for the enemy to distroy itself.
Well I'm having some trouble with the enemies health, the first one works fine, but the other just die with 1 hit, maybe its reducing the variable "health" of all my enemies instead of doing it individually.
How do I fix that?

Sunday, March 23, 2014 at 6:06:54 PM

Leave a comment

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