Pretty sure this is a silly question but I can't seem to squeeze an answer out of my noggin! :|
In my game, I'd like my choice menus to have aesthetically different buttons, something like this:
which would need a different file to be used for each button, but I have 0 idea how to go about doing it.
If it ends up being difficult to code I can just scrap the idea, but I think it'd look nicer aesthetically if I could make the choice buttons like this instead of all looking the same.
Help would be very appreciated!!
Menu Screen with Different Looking Choice Buttons
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.
- timepatches
- Regular
- Posts: 91
- Joined: Sun Aug 14, 2016 1:52 am
- Completed: When Aster Falls; Were|House; DemiDato: Monster Dating Show; Grand-Nya
- Projects: The Bat-Chelor
- Organization: Sad Ghost Studios
- Tumblr: sadghoststudios
- itch: Sad Ghost Studios
- Location: Australia
- Contact:
Re: Menu Screen with Different Looking Choice Buttons
Class UniqueButtons:
Set this up somewhere. Put your backgrounds inside the "buttons" list. I used three differently coloured boxes as placeholder.
You need to modify the screen_choice(items) screen in your screens.rpy to look like this:
This is fairly simple, but I don't know how much knowledge of Ren'py\Python you have, so if you want a detailed explanation feel free to ask.
Code: Select all
class UniqueButtons:
buttons = [Solid("#ff0000",xfill=True,yfill=True),Solid("#00ff00",xfill=True,yfill=True),Solid("#0000ff",xfill=True,yfill = True)]
counter = 0
@classmethod
def GetBackground(cls):
bg = cls.buttons[cls.counter]
cls.counter = ((cls.counter + 1) % len(cls.buttons))
return bg
@classmethod
def Reset(cls):
cls.counter = 0
You need to modify the screen_choice(items) screen in your screens.rpy to look like this:
Code: Select all
screen choice(items):
style_prefix "choice"
vbox:
for i in items:
textbutton i.caption:
action i.action
background UniqueButtons.GetBackground()
$UniqueButtons.Reset()
- timepatches
- Regular
- Posts: 91
- Joined: Sun Aug 14, 2016 1:52 am
- Completed: When Aster Falls; Were|House; DemiDato: Monster Dating Show; Grand-Nya
- Projects: The Bat-Chelor
- Organization: Sad Ghost Studios
- Tumblr: sadghoststudios
- itch: Sad Ghost Studios
- Location: Australia
- Contact:
Re: Menu Screen with Different Looking Choice Buttons
Just wanted to say thankyou for the help!! I haven't had the chance to try implementing this code yet but it looks like exactly what I was after.
(I might need that extra bit of help but I'm going to give it a red hot go first ^^)
Thanks again!
(I might need that extra bit of help but I'm going to give it a red hot go first ^^)
Thanks again!
- Zaeriz
- Newbie
- Posts: 3
- Joined: Mon May 09, 2022 12:26 pm
- Projects: Space Project (Name TBD)
- Tumblr: Zaeriz
- Location: AZ
- Discord: zaeriz#3907
- Contact:
Re: Menu Screen with Different Looking Choice Buttons
Does this work with changing the image while it's being hovered over?
-- Zaeriz was here. --
- Zelan
- Lemma-Class Veteran
- Posts: 2436
- Joined: Tue Mar 01, 2016 7:23 pm
- Completed: The Dark
- Projects: Cosplay Couple
- Tumblr: evns
- itch: Zelan
- Discord: ltnkitsuragi#7082
- Contact:
Re: Menu Screen with Different Looking Choice Buttons
You'll want to use hover for this. (: https://www.renpy.org/doc/html/style_pr ... t=slow_cps
- Zaeriz
- Newbie
- Posts: 3
- Joined: Mon May 09, 2022 12:26 pm
- Projects: Space Project (Name TBD)
- Tumblr: Zaeriz
- Location: AZ
- Discord: zaeriz#3907
- Contact:
Re: Menu Screen with Different Looking Choice Buttons
Thank you!Zelan wrote: ↑Tue May 10, 2022 3:45 pmYou'll want to use hover for this. (: https://www.renpy.org/doc/html/style_pr ... t=slow_cps
-- Zaeriz was here. --
Who is online
Users browsing this forum: Google [Bot], Nozori_Games