Just wondering, is it possible to make a menu that scrolls with the arrows keys, kind of like the one below?
Instead of moving the highlighted area, it moves the menu instead. Is it possible to do that in Ren'py?
Roulette menu? (For lack of a better name)
Forum rules
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.
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.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Roulette menu? (For lack of a better name)
While you could probably do it with a user-defined displayable, I can't think of an easy way to accomplish this.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Veteran
- Posts: 448
- Joined: Wed Nov 18, 2009 11:17 am
- Completed: Loren
- Projects: PS2
- Location: Germany
- Contact:
Re: Roulette menu? (For lack of a better name)
Code: Select all
$ rllabel = [["gold",Skip()], ["silver", Skip()], ["bronze",Skip()], ["cooper",Skip()]] # A list of all menu options. Containing the name of the option and the action for the button.
$ buorder = {"top": rllabel[0][0], "middle": rllabel[1][0], "bottom": rllabel[2][0]} # A dictionary, the keys define the visible "slots", the value the assigned name.
screen roulette:
modal True
python:
if buorder["middle"] == buorder["top"]: # In this case the option above the current was selected
rllabel = rllabel[-1:] + rllabel[:-1]
buorder = {"top": rllabel[0][0], "middle": rllabel[1][0], "bottom": rllabel[2][0]}
#focus_down
elif buorder["middle"] == buorder["bottom"]: # In this case the option below the current was selected
rllabel = rllabel[1:] + rllabel[:1]
buorder = {"top": rllabel[0][0], "middle": rllabel[1][0], "bottom": rllabel[2][0]}
#focus_up
vbox: #Draw the menu with textboxes
xalign 0.5
yalign 0.5
xmaximum 120
textbutton(buorder["top"]) hovered SetDict(buorder, "middle", buorder["top"]) xfill True action rllabel[0][1]
textbutton(buorder["middle"]) hovered SetDict(buorder, "middle", buorder["middle"]) xfill True action rllabel[1][1]
textbutton(buorder["bottom"]) hovered SetDict(buorder, "middle", buorder["bottom"]) xfill True action rllabel[2][1]
Avatar created with this deviation by Crysa
Currently working on:
Currently working on:
- Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III
Re: Roulette menu? (For lack of a better name)
Hmm, I think it could be done if, instead of doing that, we just pretend to highlight the middle button, and implement a variable that increases when the focus is shifted up by 1, and decreases when the focus is down by 1. Then, when the player selects, it uses the variable to determine which option was selected?Anima wrote:It's as close as I could get. You just need to find a way to reset the focus to the middle button. Unfortunately, that's currently not easily done.Code: Select all
$ rllabel = [["gold",Skip()], ["silver", Skip()], ["bronze",Skip()], ["cooper",Skip()]] # A list of all menu options. Containing the name of the option and the action for the button. $ buorder = {"top": rllabel[0][0], "middle": rllabel[1][0], "bottom": rllabel[2][0]} # A dictionary, the keys define the visible "slots", the value the assigned name. screen roulette: modal True python: if buorder["middle"] == buorder["top"]: # In this case the option above the current was selected rllabel = rllabel[-1:] + rllabel[:-1] buorder = {"top": rllabel[0][0], "middle": rllabel[1][0], "bottom": rllabel[2][0]} #focus_down elif buorder["middle"] == buorder["bottom"]: # In this case the option below the current was selected rllabel = rllabel[1:] + rllabel[:1] buorder = {"top": rllabel[0][0], "middle": rllabel[1][0], "bottom": rllabel[2][0]} #focus_up vbox: #Draw the menu with textboxes xalign 0.5 yalign 0.5 xmaximum 120 textbutton(buorder["top"]) hovered SetDict(buorder, "middle", buorder["top"]) xfill True action rllabel[0][1] textbutton(buorder["middle"]) hovered SetDict(buorder, "middle", buorder["middle"]) xfill True action rllabel[1][1] textbutton(buorder["bottom"]) hovered SetDict(buorder, "middle", buorder["bottom"]) xfill True action rllabel[2][1]
It'd look something like this, in my idea.
Code: Select all
# In Java
int selection = 0; #assigns variable
# wheel stuff here
# arrow keys input
if (key == input.key_DOWN)
selection--; #lowers selection by 1
#code for turning the wheel
if (key == input.key_UP)
selection++; # raises selection by 1
#code for turning the wheel goes here
if (key == input.key_ENTER)
if (selection == 0)
StartGame = new StartGame;
#repeat for other options
Who is online
Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot]