- Home /
Zelda like pause menu
Is there a tutorial or asset to make a pause menu as in Zelda ocarina of time? If no, could some one could give me a basic tutorial of a pause menu and some tips so i could make it like zelda's one?
Thanks
Answer by psychentist · Aug 06, 2013 at 04:34 AM
Look into some examples of how credit rolls are done. This will show you how to make a scrolling GUI. All you need to do is have the GUI always visible, but positioned above the screen. Make a static boolean in your world controller script called isPaused. Player movements and enemy behaviors should be subject to an isPaused check in the update. You will have to do some trial and error to get the numbers just right, but with some common sense you should be able to get the menu to scroll down and stop when it is fully visible and centered on the screen.
It will go something like this
static var isPaused : boolean = false;
// You may want this in a different script.
var menuMinVertPos : float;
// Note : you will want to change this to a private var
// once you get your numbers right. You don't want
// people jacking around with this in the inspector
// if you let other people make levels for you.
var menuMaxVertPos : float;
// Same here.
var increment : float = 0.05;
// Same here. Increment will be how far the
// menu moves each frame. Smaller increment
// means smoother, but slower animation.
private var menuCurVertPos : float;
function Update(){
if (isPaused){
if (input.GetButton("Pause")){
isPaused = false;
HideMenu();
}
}
}
if (!isPaused){
if (input.GetButton("Pause")){
isPaused = true;
ShowMenu();
}
}
}
function ShowMenu(){
for (menuCurVertPos=menuMinVertPos;menuCurVertPos<menuMaxVertPos;menuCurVertPos+=increment){
yield waitForSeconds(0.01);
// change the yield time to alter the scroll speed of
// the menu without affecting smoothness of animation.
}
}
function HideMenu(){
for (menuCurVertPos=menuMaxVertPos;menuCurVertPos>menuMinVertPos;menuCurVertPos-=increment){
yield waitForSeconds(0.01);
}
}
function OnGUI(){
//Do your GUI stuff here. Use menuMaxVertPos and menuMinVertPos
//to declare your positions. Example:
GUI.Label (Rect (Camera.main.pixelWidth / 2, menuCurVertPos, Camera.main.pixelWidth / 3, Camera.main.pixelHeight/ 10), "Executive Producer : ", gui1);
}
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Creating Pause Game Menu 1 Answer
GUI Box with a GUI Skin 1 Answer