Now if you run the debug mode you will also notice there is well
As you can see above in green box value of Gem_Destroyed will be updated every time Gem is destroyed.
One thing I like to say is anytime if your project not working properly takes a look in Debug mode here you will find what is what going on with project. I always use this to check my Global variable, sprite, etc.
Now we need to add some kind of animation. We don’t need fancy or decorative just use Construct 2 already built in. like so;
Remember our line 2 code every tick well in that just line
Every tick ACTION Gem_Stones rotate 2 degree clockwise
Or whatever you fancy longs animation is not over done.
Now our game is taking shape but still need more. Think what else we can add. Now this part is yours to think ahead and do what you think is best but, for me I am going to add Global variable Timer = 0. What I am going to do is check player is getting good with his game play if yes then we need to add challenge. Make our game little difficult for he or she. Open your Main Event sheet and add this line.
Timer = 0
Back to our Game layout add text and name it txtTimer, position at 896, 0 now we are ready to set Timer.
Now add this line of code in code line 2
Every tick ACTION system add dt to Timer
Every tick ACTION set Text to int (Timer)
(DELTA TIME) to learn more read Construct2 manual on dt.
Please add another layer and name it HUD, also move all TEXT on HUD layer. Also add text and name it txtMSG and place at 160, 320. In text just add this text as MSG Well done! Bonus 50 to Score. Also set it invisible.
If you run your project in your project you will notice the INT function will round up and show you the seconds in Timer text. Now there are many ways we can design our game to end. Using Timer, Score, or not reaching score goal, whatever you think. What I am teaching you is just guide you towards your goal, I cannot teach you or tell you everything.
In our simple game I want to know if player is getting easy to play game if answer to this question is yes then I want to give him or her hard time to play game. We can increase speed of Gem_Stones and check against Timer. To do that lets say if Timer is 20 seconds and Gem_Destroyed less than 10 then we do something to give player challenge. Add lines below;
Now if you don’t add trigger once then the result of setting txtMSG VISIBLE OR INVISIBLE not work, try it for yourself.
Now it’s very well when you collect Gem_Stones one needs some kind of animation. Let’s add little spark to our game.
Add Particles set size 10, 10 and use any color you like. Add Particles effect in code line 4 I already added these Particles see code line 4. Now if he or she reach 40 seconds on timer then add line 9 same as above but replace 20 to 40 and speed * 4. When player reach 60 add line 10 same as 9 but this time let’s make little different.
On game layout click on Gem_Stones and give behaviour sine, and SET not active at start. What we do is set this in line 10 like below:
Please don’t forget to add code line start of layout ACTION sine to Inactive or it will start soon as you run project. We want sine to start at about 60 seconds and not before that. Also add line code 11 as well because once you activate sine Gem_Stones will drift outside layout that is waste of time.
Now I have come to end of my journey and add little ending to our game. On second thought I am letting you to create ending to our game. Be brave I know you could do it no doubt about that. Also if you want to cheat and see the simple ending I created take a look at CAPX I have provided. I hope you learn something and remember to buy licence, authorization for Construct 2. Money well spent.
NOTE GAME END TIME IS 90 SECONDS
God bless you all and please I want some comments on my tutorial. I am not asking much, I don’t want your money all I want is you to learn and make your life better. Without education what can one do?
Thank you Lord Shiva (C.G.Patel)