Hay Hay,
I had a lot of trouble making a good GUI for my game, but here it is and I have put the code with it so people can use it.
It was a little difficult to figure out for me at first, how to put the things where I wanted them, but well hard work pays off
Here is the code use it well:I had a lot of trouble making a good GUI for my game, but here it is and I have put the code with it so people can use it.
It was a little difficult to figure out for me at first, how to put the things where I wanted them, but well hard work pays off
Code: Select all
label main_menu:
show front
$ ui.vbox (xpos=0, ypos=0)
$ ui.imagebutton("Start.png", "Start.png", clicked=ui.returns("start"))
$ ui.close()
$ ui.vbox (xpos=627, ypos=0)
$ ui.imagebutton("Load.png", "Load.png", clicked=ui.returns("load"))
$ ui.close()
$ ui.vbox (xpos=0, ypos=500)
$ ui.imagebutton("Pref.png", "Pref.png", clicked=ui.returns("prefs"))
$ ui.close()
$ ui.vbox (xpos=631, ypos=500)
$ ui.imagebutton("Quit.png", "Quit.png", clicked=ui.returns("quit"))
$ ui.close()
$ result = ui.interact()
if result == "start":
hide front
$ renpy.jump_out_of_context("start")
elif result == "load":
jump load_screen
elif result == "prefs":
jump preferences_screen
elif result == "quit":
$ renpy.quit()
return
So now to explain:
Code: Select all
label main_menu:
show front
Code: Select all
$ ui.vbox (xpos=0, ypos=0)
$ ui.imagebutton("Start.png", "Start.png", clicked=ui.returns("start"))
$ ui.close()
Always close every Part with the ui.Close() code, or it will not work.
This you do with any kind of button you want in your menu, even a help button or extras or whatever.
Code: Select all
$ result = ui.interact()
if result == "start":
hide front
$ renpy.jump_out_of_context("start")
elif result == "load":
jump load_screen
elif result == "prefs":
jump preferences_screen
elif result == "quit":
$ renpy.quit()
return
(I hope this was somewhat clear, since I am bad at understanding coding and this is what i think is the easiest to read and understand.)
Also more to come once I've figured out the rest!