- Home /
How to make a scrollable menu like angry bird?
I'm trying to "clone" the scrollable and selectable menu system like angry bird. But, I don't know how to make it. My idea is: when the user click in to a level image, the selected level is centered and focus, and when the user click again, the app starts a new scene.
Now, I have the below code that represents three levels. I've used the 'window' and GUILayout. If I change GUILayout to GUI, the menu don't scroll, but when I use GUILayout the window shows nothing.
It my first menu creation and I don't know how to do that. How I can do this better and how I can do that?
var window_size = 300;
var window_padding = 100;
private var index = 0;
function OnGUI () {
// First level
GUILayout.Window (0, Rect ((Screen.width - window_size) / 2 + (window_padding + window_size) * (0 - index), (Screen.height - window_size) / 3, window_size, window_size), DoMyWindow, "Universe 1");
// Second level
GUILayout.Window (1, Rect (((Screen.width - window_size) / 2) + (window_padding + window_size) * (1 - index), (Screen.height - window_size) / 3, window_size, window_size), DoMyWindow, "Universe 2");
// Third level
GUILayout.Window (2, Rect (((Screen.width - window_size) / 2) + (window_padding + window_size) * (2 - index), (Screen.height - window_size) / 3, window_size, window_size), DoMyWindow, "Universe 3");
}
// Make the contents of the window
function DoMyWindow (windowID : int) {
switch(windowID) {
case 0:
Debug.Log("1");
index = 0;
break;
case 1:
Debug.Log("2");
index = 1;
break;
case 2:
Debug.Log("3");
index = 2;
break;
}
}
If you're trying to do a complicated, dynamic GUI, you might be better checking out something like NGUI or EZGUI.
Answer by Nilaakash · Aug 16, 2016 at 03:25 PM
https://www.youtube.com/watch?v=xSDfSDTtUMs i think this might help you
Your answer
Follow this Question
Related Questions
How to make camera position relative to a specific target. 1 Answer
dropdown menu error 1 Answer
Making a Pause Menu 1 Answer
Menu Button help 1 Answer
Dropdown button... 0 Answers