Menu and game screen layout done now we have code to add for our menu project. In menu project we be using GROUP code, being wise man Ashley has gave you wonderful tool in Construct 2. If you use GROUPING CODE you can ACTIVATED when you need it and DEACTIVATE when you don’t need. Now isn’t that great, Ashley wonderful thanks. So when you see my code please make sure you code it in properly or result will not be what you expect or look ahead to your satisfaction.
Open Main Event sheet in editor and add GLOBAL variable
1. MusicON = 0
2. WAD_Keys = 0
3. Choice = 0
4. arrow_Keys = 0
5. MSG = “” (text)
Start of layout adds lines below;
These lines are self explained, you be wondering why I added at start wait command when I tested on my PC Construct 2 was not behaving as it should but, once I added wait command it work like treat, take care of whatever glitch, malfunction was.
For music routine here is code
As you already know it is Boolean statement false, if it is 1 no music else if it is 0 true we want Music on.
Before I go any further look at this PICTURE and study, examine properly at start all my routine of code all GROUP IS ghosted which means not one of them is ACTIVATED. We will activate them as we want in our Game.
NOTE: WHEN YOU CREATE GROUP MAKE SURE IT IS NOT ACTIVATED AT START:
Start of layout you should enter code;
For Arrow Keys add code;
For WAD keys all you do is copy this GROUP and paste it, change arrow keys to W, A, D and Change GROUP name to Wad Keys;
Nothing is changed in touch only thing changed is instead of keyboard its Touch command;
Gamepad is not same here you have to check for left analog X axis and right analog X axis one is lees then 0 and one is greater than 0, also I am using W on keyboard jump for player.
Now for last lines of code here is if Player wish to end his or her game we have included button to go back to Menu by quitting the game;