The following files have been attached to this tutorial:
This tutorial hasn't been translated.
This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.
Hey there i made this small tutorial for you guys to help you making your own FPS games so lets start. Ok at first you will need Construct 2 so go and buy it :) If you already have it just open it. Now you have to create new empty project. Chose name of your project and lets start.
Let's make first layers so click on layers button and add two more layers name it background , main , hud this can be helpful only in future developing of your game. Now lock background and HUD layer you won't need it at this moment. Let's jump to another part.
Now let's make few sprites like gun you can make this sprites in photoshop or in construct 2 i'll use construct. Select layer main and double click on your screen and chose sprite in general and click somewhere on your screen. Now let's make pistol sprite or you can download my but just for test, now add two more sprites lets make one bullet and another for cartridge. If you are done place it outside of layout and let's go to behaviors now :)
Don't forget to add Mouse function!!!
This should be by sprites but image points are needed so open your pistol sprite and chose on left panel second from left bottom side Set Origin and image points. New window opened and there add one more image point near snout of pistol but bit before snout. This is done!
Ok as you have to know behaviours are really interesting for bullet sprite add bullet behavior and for cartridge you can add physics for nice effect :) but you don't need to.
Ok, let's add some basic things to event sheet so open it and start with first condition Mouse > On any click and action Pistol > Spawn another object > chose object bullet at image point 1 and enter for layer "background" Now you can start and you see your gun is shooting so you have done this one thing but once you will spawn too much of bullets game will start to lag and how to fix this? Just add new behaviour for bullet and it's "Destroy outside of layout". This is done but what about collision models like shooting to walls and counting of bullets shots? Just go back to your layout. Add two text boxes name one Bullets and second count. Place it somewhere on layout ( only inside layout ). Now go back to your event sheet and press RMB > add global variable > Name it bullets chose number and equel to 0. Now for your first condition add new action System > Add to > Bullets and 1. Ok now let's explain this once you press any mouse button will add to global variable called bullets 1 so after each mouse button click will shoot one bullet and this number will increase.
You have to add limit for bullets shot in this mode for me it will be 1000 so just add another another condition System > Compare variable > bullets equel to 1000 and action System > Restart layout. This will restart layout once you reach 1000 bullets shotted.
Here is final part of my tutorial that you should need to make complete gun shooting layout or test for your game. You are already in event sheet so lets add another condition System > Every tick and action Text ( count ) > Set text > bullets
This will take your global variable to screen as text and on each bullet shotted will add 1 to bullet count and set text to your current bullets global variable easy right?
This isn't needed for you but can make better effect of your game its just detail but first one ask - Why we made cartridge sprite? This is why lets now use our cartridge open your pistol animation and again add origin point to cartridge box at top of the gun now copy your gun sprite and create new animation called "shooting" paste it add frame place it again and remove texture from your cartridge output on your gun add frame and again.
Now lets go to Event sheet and let's add to first mouse condition new action pistol > Set animation > "shooting" this will make effect of cartridge output has opened and again closed but now has dropped no cartridge just add it to same condition as action Pistol > Spawn another object > cartridge at image point 2. Here you are you can change your animation speed let it's correct with bullet shooting speed or you can change max bullets on screen to 1 and it will fix this problem just add System condition Compare two values and input bullet.Count is greater than 0 action bullet destroy.
I hope this was helpful for your project if you need to explain something just ask me on private msg.