i wanna know how you make your game pause by pressing a key and not by going to the crappy menu option up the window! this is what i had in mind: pressing the enter key makes game pause then by pressing the same key again it will make the frickin game unpause! Thanks for your time clickers!
Personally, i put all my "game" events in one big group and "pause" events in another. Disable the game group when paused, and enable it when unpaused. Don't forget to stop and start your animations though! This could cause problems if you use MMF movements, but i've never tried it.
If it's MMF1.5 or 2.0, you can create a subapp object. It basically displays a level within a level (you use them to create splitscreen games, for instance).
You create a separate menu frame, and then (in your playable level) create a subapp. In its properties, assign the subapp to use frame number [your menu frame number] from 'this application'.
There should be a toggle box that says 'Modal' in the properties as well. Tick it.
Now create an event which says:
ON ESCAPE PRESSED
--- Create Object: Subapp Object at (0,0)
Once you've created this, DELETE your original subapp object from the frame (important). So long as there's a 'create object' event pointing to the subapp, it will not be totally deleted. It just won't be created at the start of the frame (otherwise your game would start with the menu showing up. And having the menu displayed in the frame editor as you design the level is a nuissance anyway).
Now, in the MENU frame, add this action:
ON ESCAPE PRESSED
+Timer is greater than 2/100ths of a second
--- End the Application
This will close the menu again when you press escape a second time.
Note that a subapp thinks it's a completely separate application. So 'End the application' only closes the subapp, not the whole game.
You can tick the 'share global values and strings' option in the subapp object to allow the subapp menu to communicate with the rest of the game. This needs to be done, for instance if you want a feature like a 'QUIT' button.
This solution works very well because of that 'MODAL' setting we used above. This innately pauses the game while it runs the subapp. When the subapp closes, the game resumes.
Thats certainly a good workaround dines. I've always manually waded in like nick's method; activate/deactivate event groups and stop animations. However, using subapps it could be potentially complicated to pass data back and forth from the menu to the game. Its quite possible, you just need to have a very good handle one what you are doing.
I'm not sure what the term 'Modal' means, but what it DOES is thus:
It pauses the parent application while its child window runs. So like thos programs where an error message pops up, and you can't just minimise the error message and carry on working. You have to click OK or CANCEL before you can carry on working.
Such error messages are Modal.
In the case of a subapp as a menu, this just works in our favour because it automatically pauses the game running underneath.
Originally Posted by DeadmanDines I'm not sure what the term 'Modal' means, but what it DOES is thus:
It pauses the parent application while its child window runs. So like thos programs where an error message pops up, and you can't just minimise the error message and carry on working. You have to click OK or CANCEL before you can carry on working.
Such error messages are Modal.
In the case of a subapp as a menu, this just works in our favour because it automatically pauses the game running underneath.
In Visual Basic 6 you could create Modules to go with your main program which were these little offshoots of code. I never really had much use for them aside from maybe one at the beginning that initialized everything.
I've always used the activate / deactivate method myself. Dines is probably doing it the "right" way though.
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
I personally use the activate/deactivate method, it's extremely easy and stable + values don't need to be global. About the subapp method, say you wan't to change objects positions and such in realtime, is that possible or is the game frozen until menu is exited?