Skip to main content

Title Customization

Author: NingNing
Last update:2022-05-29


This tutorial is about making the cover/title

The code for the title (main menu) can be found in screen main_menu() in screen.rpy
It should be on line 355 if nothing has been changed

Title code that has not changed

screen main_menu():

## This ensures that any other menu screen is replaced.
tag menu

add gui.main_menu_background

## This empty frame darkens the main menu.
frame:
style "main_menu_frame"

## The use statement includes another screen inside this one. The actual
## contents of the main menu are in the navigation screen.
use navigation

if gui.show_name:

vbox:
style "main_menu_vbox"

text "[config.name!t]":
style "main_menu_title"

text "[config.version]":
style "main_menu_version"


style main_menu_frame is empty
style main_menu_vbox is vbox
style main_menu_text is gui_text
style main_menu_title is main_menu_text
style main_menu_version is main_menu_text

style main_menu_frame:
xsize 280
yfill True

background "gui/overlay/main_menu.png"

style main_menu_vbox:
xalign 1.0
xoffset -20
xmaximum 800
yalign 1.0
yoffset -20

style main_menu_text:
properties gui.text_properties("main_menu", accent=True)

style main_menu_title:
properties gui.text_properties("title")

style main_menu_version:
properties gui.text_properties("version")

If nothing has been changed, the title should look like this (if the color was red at first)
Image

Edit Navigation

To change the title text you need to find screen navigation()
If nothing has changed it should be found on line 292
The code here will be used by Game Menu and Main Menu, so changing the code here will modify it to the title too

  • As long as you change the text inside the brackets -> "" these two upper quotation marks can change the text

Unchanged code:

        if main_menu:

textbutton _("Start") action Start()

else:

textbutton _("History") action ShowMenu("history")

textbutton _("Save") action ShowMenu("save")

textbutton _("Load") action ShowMenu("load")

textbutton _("Preferences") action ShowMenu("preferences")

if _in_replay:

textbutton _("End Replay") action EndReplay(confirm=True)

elif not main_menu:

textbutton _("Main Menu") action MainMenu()

textbutton _("About") action ShowMenu("about")

if renpy.variant("pc") or (renpy.variant("web") and not renpy.variant("mobile")):

## Help isn't necessary or relevant to mobile devices.
textbutton _("Help") action ShowMenu("help")

if renpy.variant("pc"):

## The quit button is banned on iOS and unnecessary on Android and
## Web.
textbutton _("Quit") action Quit(confirm=not main_menu)
tip

Maybe you will wonder why there are IF, else...other things that are not straight, just write it like Quick Menu

  • The code here is not for the title alone, but also for the menu in the game (game menu)
  • Some options should not appear on the title, only in the in-game Menu
  • Some options will not appear on the in-game Menu , only on the title

If you don't know what the code above means, here's a little explanation:

Understand the meaning of code

1.

  • if main_menu: = If the player is currently on the Title screen
    • show this text button --> textbutton _("Start") action Start()
    • so Start will appear on the Title
    • so Start doesn't appear on screens other than the Title

2.

  • else: = If the first sentence doesn't hold = the player is not on the Title screen now
    • Show 2 text buttons --> textbutton ("History") action ShowMenu("history") & textbutton ("Save") action ShowMenu("save")
    • So History and Storage will appear on the screen other than the Title
    • So History and Storage don't appear on the Title

3.

  • this text button --> textbutton _("Load") action ShowMenu("load") and
  • this text button --> textbutton _("Settings") action ShowMenu("preferences")
    • will appear on all screens

4.

  • if _in_replay: = If the player is currently in a replay
    • Show this text button --> textbutton _("End Replay") action EndReplay(confirm=True)
    • Players in replay/replay will see a button to end replay (End Replay)
    • Players not in replay will not see this button

5.

  • elif not main_menu: = If the player is no longer on the title
    • show this text button --> textbutton _("title screen") action MainMenu()
    • so this button doesn't appear on the title
    • After the player clicks, they will go back to the title

6.

  • This text button --> textbutton _("about") action ShowMenu("about") will appear on all screens

7.

  • if renpy.variant("pc") or (renpy.variant("web") and not renpy.variant("mobile")):
    • If the player uses a computer (pc) or a web page (web) instead of a mobile phone (mobile)
    • Show this text button --> textbutton _("help") action ShowMenu("help")
    • So the description will only appear on the computer (pc) or web page (web)
    • So the help don't appear on the phone (mobile)

8.

  • if renpy.variant("pc"): = If the player is using a computer (pc)
    • show this text button --> textbutton _("leave") action Quit(confirm=not main_menu)
    • so leave this button will only appear for players who are playing this game on a computer

Now we know what the various codes mean~
Now you can change these codes as needed

  • If you want to change the text, just change the text inside ""
  • To change the arrangement just move the code up or down
    • like moving the sentence --> textbutton _("Load") action ShowMenu("load") to
    • textbutton _("Settings") action ShowMenu("preferences")
    • So the settings will be displayed first and then Load will appear below the settings

改變文字的位置

  • You can use xpos and ypos to change the position of the text
  • By default, everyone is on the left, listed according to the order of Textbuttons
  • Example usage:
    - textbutton _("Start") action Start() xpos 630 ypos 80
    - textbutton _("Load") action ShowMenu("load") xpos 630 ypos 100
    Preview:
    Image

Change text color, size

change color

To change the color of the title text you can change it in gui.rpy but it will affect the text on all screens
So you can also change it in screen.rpy, if you want to change the text color of the title
You can find style navigation_button_text: and write it below:

  • color "#" = the color displayed when the mouse is not over the button --> # followed by the color code to be used, example: #ffffff (white)
  • hover_color "#" = the color displayed when the mouse hovers over the button --> # followed by the color code to be used, example: #000000 (black)

Change size

Write size under tyle navigation_button_text: and add a number to it

Example (change the position, text color, size of the cover):
Styling code used:

style navigation_button_text:
properties gui.button_text_properties("navigation_button")
color "#B0E0E6"
hover_color "#000000"
size 40

image

tip

The stuff changed here will also affect the Menu in the game


This post is over now~ You can give me / my website a clap if this help you! My website --> https://spaceofningningen.blogspot.com/ Image Alt Thank you for your support~