- Title: Pausing your game
- Description: Pauses your game when pressing a key on your keyboard.
- GM Version:
- Registered: yes & no (you can choose)
- File Type: .gmk
- File Size: 28.3 KB
- File Link: yoyogames link
A very simple examlpe that shows you how to pause the game by pressing a key on the keyboard.
It uses only 6 lines of code to pause the game (and some additional lines to draw "game paused" on the screen).
You can easily implement it into your game by copying obj_pause to your game project.
If you want a pause menu to pop up when you pause the game, it's easy to add that using this as a base. A nice way to achieve this is to give all pause menu objects a parent (name it parent_menu), and in the create event of obj_pause, you write the following code: instance_activate_object(parent_menu);. You will also need to give it a code to stay on the screen if you are using views.
GM Pro is required for one of the functions, so the .zip file also includes a .gmk which works with GM lite. the only downside to this is that unless you have pro, all objects on the screen will turn invisible when you pause. but then again, that's exactly how pausing in old mario games worked (i guess nintendo didn't have GM pro back then ;D)
Feel free to comment and rate the tutorial/example on the yoyogames website, and feel free to post any question here ^^
Edited by Pandaboy, 29 March 2012 - 02:02 AM.