Game Development Reference
In-Depth Information
Objective Complete - Mini Debriefing
We just created a menu window, which can be opened by pressing the M key and closed
by clicking on the x buton at the top-right corner of the menu window. We also have our
character texture nicely placed inside our menu window. Next, we made this window
draggable and made sure it is always on the screen by using the following code:
r_window.x = Mathf.Clamp(r_window.x, 0.0, Screen.width - r_window.
width);
r_window.y = Mathf.Clamp(r_window.y, 0.0, Screen.height - r_
window.height);
Basically, we set the minimum limit of our window in the x-posiion to 0 and the maximum
to the screen width subtracted by the window width; we also set the minimum limit of
y-posiion to 0 and the maximum to the screen height subtracted by the window height.
We will see this result when we click play the game and try to drag this window off the
screen. Lastly, we created a tab that can be clicked to change to a different page.
 
Search WWH ::




Custom Search