This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
can anybody help me? maybe give a simple example.. I appropriate your help
- Posts: 461
- Joined: Sun Mar 06, 2011 9:01 am
- Projects: Elements: The Academy
- Organization: Mushroom Samba
So, here's my imagebutton code:
Code: Select all
ui.vbox(xpos=0.86, ypos=0.78, focus_mask=True) ui.imagebutton("menus/skip button idle1.png", "menus/skip button hover1.png", clicked=toggle_skipping, focus_mask=True) ui.imagebutton("menus/save button idle1.png", "menus/save button hover1.png", clicked=ccinc("_game_menu_save"), focus_mask=True) ui.imagebutton("menus/load button idle1.png", "menus/load button hover1.png", clicked=ccinc("_game_menu_load"), focus_mask=True) ui.imagebutton("menus/quit button idle1.png", "menus/quit button hover1.png", clicked=Quit(), focus_mask=True) ui.close()
vbox is a box you can use if you have more than one imagebutton and want to keep them in the same place. The xpos/ypos in the braces determine the position: xpos=0.0, ypos=0.0 is top left and xpos=1.0, ypos=1.0 is bottom right.
Note: If you're not using a vbox, you should put the xpos/ypos coordinates in the braces of the imagebuttons themselves (after defining their functions -see below).
focus_mask=True means that if the buttons are on a transparent BG, only the nontransparent parts of them would be selectable/focused.
Now, the ui.imagebutton is the button itself. The first file in the braces is the image of the idle button (without the mouse over it) and the second is of the button when the mouse hovering over it. clicked= determines what the button does. For example, clicking the Skip button will start skipping. If a button's function is to go to another menu (for example, the load menu), you need to use ccinc like in the example above. In this case, you need to put this
Code: Select all
$ ccinc = renpy.curried_call_in_new_context
The ui.close() means that's the end of the vbox.
Hope that helped you at least a bit.
Once again, keep in mind that I'm now very confident in my knowledge.
Users browsing this forum: Google [Bot]