Lets us see how long player can continue to play before he or she is destroyed. To check that we need to add code below;
Before we do that let’s create Global Variable and call it isAlive = 1. What this mean is if player is alive set it to 1 if player is dead (Kaput) set it to 0. That is it
Now add line of code at
Start of layout (Action) System set value isAlive to 1
Also add this line at bottom
Arrow overlapping player system set value to isAlive to 0 means dead.
Now I am making it easy for none Licences of C2 to use this code below:
And now those has Licence please add Family and name it HUD_Objects
In HUD_Objects add
The txtGameover cannot be placed in that family because it’s different type of object so it will be add in the start of layout. Code for family looks like below:
Advantage of buying Licence your code can be efficient and well-organized.
Now when player is dead code below for none Licences user of C2:
Now when player is dead code below for Licences user of C2:
If you test run now it will work fine but, there is problem our score is keep adding and we don’t want that do we? So to fix that we need to go in line 7 and add another condition like below so it will looks like below:
Now test it. Working nicely as we expected
Only thing left is checking for BUTTONS and here it is below:
Now please remember to download CAPX because I have made some changes that are not here. I left some code out because I want you to add and learn. If you don’t learn from your mistake what else can you do? I want you to improve this project by adding home layout, and so on. Good luck
God bless Lord Shiva
Please live some comments that is all I ask.