This is kinda brief and only goes over the basics, but the documentation should cover all of the terms I use here if you want to know more.
This only covers using imagebuttons.
Start off by making a new screen. In screens.rpy, find any area that isn't part of another screen, and at the very left of the line, type:
This is the name of the screen, it can be anything you want bar a few exceptions.
On a new line, add four spaces to create a 'block'
This is called indentation and is an important part of python.
You might want to add one empty line for readability, but it's not really required.
Inside this screen, you can now add things. You want to put some buttons across the top of the screen to act as an always visible menu, so we need to set some parameters for the screen first.
Add zorder 49
This is so it shows above everything except the confirm screen.
Next you need something to hold the buttons. You can add positional info directly to an imagebutton, but a container is used frequently, so it's worth learning how to use it
You'll want a hbox for this (horizontal box)
Type hbox and add : at the end, then on the next line, add an additional four spaces.
You should have something like this now:
Code: Select all
screen top_menu() :
zorder 49
hbox:
#This is a comment, it isn't part of the code.
Now you have to position the hbox. There's lots of ways, but you can just use xpos and ypos most of the time.
Use integers (whole numbers) to set the coordinates where you'd like based on pixel count.
Left is 0, right is the maximum resolution of your game (so if your game is 1920*1080, the furthest point right would be 1920, but anything aligned here would be off the screen)
Top is 0 and bottom is again your resolution limit (1080)
Or you could use a float, which is like a percentage. So for halfway, 50%, use 0.5
The hbox needs to be aligned top left, so
xpos 0
ypos 0
Add xfill True to force the hbox to fill the available x space (currently the entire width of the screen)
Now all that's needed is to add some imagebuttons and the screen is done (enough)
Still inside the hbox, add an imagebutton.
Here's a basic button.
Code: Select all
screen top_menu() :
zorder 49
hbox:
#This is a comment, it isn't part of the code.
xpos 0
ypos 0
xfill True
imagebutton:
idle "my_image_idle.png"
hover "my_image_hover.png"
action ShowMenu("save")
You'll of course need those images inside the images folder.
There's a lot more you can do to each part of this, but this should cover the basics.
You can later add things like spacing or another container etc.
To use the screen, switch over to script.rpy and simply add show screen top_menu when you want it to appear. Probably at the very start of the game, so add it right after the line 'label start:', again remembering about indentation.
For a hotspot on your drawer, do the same thing pretty much. You'll have to hide screen screen_name when you want to get rid of the hotspot. And choose an appropriate action, for example, Call "drawer_opened", which will take the player to the label "drawer_opened", and then come back to where they were when they clicked on it, once hitting a "return" in the script.
Sorry about how brief this was, I'm short on time lately and unable to give a decent explanation.