Entering and remembering these codes everytime you need to make a game can get to be very annoying. Thats why I will show you how to turn it into an action button. We will use the Action Library Maker. If you don't have it you can download it here:
http://www.yoyogames.com/extensions (It has Action Library Maker and Extension Maker)
This is where the easy part ends and the intermediate part starts. In this tutorial I will guess that you have never used Action Library Maker before. It adds action buttons that you can use in your games. Be sure to follow the tutorial as close as possible. One mistyped letter can mess up the entire thing. So, lets begin.
Start up Action Library Maker and we will first make your new tab:
Where it says "Enter your title here" put a name for your tab. Then go down and click on the "Add" button.
Put "Pause" for the name and make a short description for it. Now, at the bottom left it says type. Select code. Then click on the code button that appears. This will come up:
Now here is the code to put in:
{
draw_set_color(argument0);
//sets the color for the font later
draw_set_font(argument1)
//sets a font that you made; "B_system" was my font's name;
draw_sprite_stretched(argument2,0,0,0,room_width,room_height);
draw_text(32,176,argument3)
//draws the text "Game Paused: Press any key to continue"
screen_refresh();
//refreshes the screen using the current room image
if argument4 =0
{
keyboard_wait();
//makes the code wait for somebody to press a keyboard button
}
else
{
mouse_wait();
}
io_clear();
//clears the keyboard
}
Its diffrent from the code we put in above. The argument part will make sense in a minute. Here is the screenshot for the next set of instructions. Look at it first so you can see what I mean:
Unselect the Question, Show "Apply to", Show "Relative" if they are checked
In the argument count change the number to 5.
Now a bunch of boxes will appear. For the first row (going down) put the following text in.
In the first box put "Text Color" in.
For the second box put in "Font".
Third "Background Sprite"
Fourth "Pause Message"
Last put "Unpause on".
The second and third row (going down) should match my screen shot except for the "Pause Message" one.
Its secondary box should be set to a string!
After you put Menu in for the last box on the second row another box will appear. Put this in it:
"Keyboard|Mouse"
Now click the save button at the top. THIS IS IMPORTANT!!! Save it to:
C:/Program Files/Game_Maker7/lib/
Save it and open Game Maker. Now create a sprite. Make it a black box with any size. Also, create a font. Make it however you like. Make an object and create a "On keyboard Press P" event. Go to our new tab. Drag our new action onto the action list. Fill in the Arguments (you should know what they are for now). And test it out! If it doesn't work you may have missed something in the tutorial. If it works than you don't have to memorize that long code now!
There you go! You made your first Action Library
If you have any questions or problems please post them below!
