Create new Layer, and name it HUD (head-up display), set Parallax to 0, 0. Create 6 Textboxes, and name it as;
Place all your text boxes at the top left-hand corner on HUD layer, because when you run your game HUD parallax is set to 0,0 all those text boxes will be shown on gameplay screen.
1. Set size of text boxes, txtScore, txtNumAmmo, txtPlayergethit, txtGoldbars, txtHealth, to;
2. 96 x 28
3. txtMSGBox size set to 200 x 48
In our Global Event Sheet create Variable, and name it MSG as text;
Whenever you want any message to be shown on game screen, just use variable MSG, and pass messages with, example if Player collide with Door, Player has no Key, Message we display will be “You need the key”, or whatever you think. Once we put this message in variable MSG all we do is set txtMSGBox to VISIBLE, for how long in seconds, then make it INVISIBLE again, that is all. The very handy way of doing this.
Insert this in our Main Game event sheet;
Here what we are checking, if Player has key door is open, if not, MSG will be shown on screen as “Need Key”, therefore we insert “Need Key” in are variable MSG, next we set property to Visible, set time 2 seconds to be shown on MSG, after 2 seconds will set it to Invisible again. Simple
In Dead_Family I have added all those sprites that should not be shown when end games. Now only one more thing left to do and that is Game over Routine, where Player dies by spikes or Snakes, this is where we need to say Game_Over.
Open your Function Event Sheet and create Function, and name it Game_Over, insert this code below;
If Variable isAlive = 0 we call this function, where we fade our hero, set animation to dead, destroy everything on the screen, the system set MSG variable to Game_Over, MSG set to visible, wait 5 seconds, reset all global variables, Restart the Game.
Please if you find this tutorial helpful, please write some comments, Thank you