Working with Ren’Py:
- Part 1: Downloading and Configuring
- Part 2: Editing and Creating Characters
- Part 3: Scenes and Showing Images
- Part 4: Menus, Labels, and Jumps
- Part 5: Variables and Conditional Statements
- Part 6: Transitions
- Part 7: Building Distributions
- Part 1: Screen Language
- Part 2: Position Style Properties
- Part 3: Animation and Transformation Language
- Part 4: Text and Button
- Part 5: Bar and VBar
- Part 6: Textbutton and Imagebutton
- Part 7: Input, Key, and Mousearea
- Part 1: Editing options.rpy
- Part 2: Editing gui.rpy
- Part 3: Style Inspector and Overriding Styles
- Part 4: Special Screen Names and Overriding Screens
- Part 5: Replacing Default GUI Images
Ren’Py + Python:
- Part 1: Setting and Using Flags
- Part 2: Python Blocks
- Part 3: User-Defined Displayables
- Part 4: User-Defined Statements
- Part 5: Custom Text Tags
Ren’Py is a engine for creating visual novels. It comes with a suite of tools for taking code and transforming it into programs that can be run on Windows, Mac, Linux, and even, with a little more work, mobile platforms like Android and iOS.
In Ren’Py menus are central to how in-game choices are presented. By choosing one option in “The Question” (shown above), the player is moved (jumped) from one section of code to another.
Open the “script.rpy” file from “The Question”.
Lines 43 – 56 demonstrate how a menu is used. Choices are under (indented) the menu and their own code is then under (indented) the text of the choice.
The keyword menu, however, only works in the above example because because it is part of two other keyword functionality: labels and jumps.
Code in the “script.rpy” file of a project in Ren’Py can be divided up into sections. These are called labels.
After characters are created and other initialization tasks are complete, Ren’Py starts a project at the label start. In the “script.rpy” file of “The Question”, this is line 12.
Labels are also be found in other places and with other names.
For example, the label rightaway is found on line 57. It is the beginning of a new section of code and immediately follows the previous menu code. In “The Question”, it is the first of two possible paths from the in-game choices.
It is accessed through another keyword, jump.
The jump keyword is used to move from one label to another. It “jumps” to that new section of code.
In “The Question”, it appears first on lines 50 and 54. Depending on what the player chooses, they are “jumped” to either the label rightaway or the label later.
Removed from any code, Ren’Py would “read” the project start to finish depending on the order of the code in the file. With using the keyword jump, projects in Ren’Py can loop, branch, and create new paths.
Menus, Labels, and Jumps
The menu keyword can be used to create in-choices. Through using existing labels, a player can be moved (jumped) from one section to another.
In “The Question”, this combination is used on lines 43 – 56 —
— and again on lines 100 – 111. Each use the menu keyword is combined with the jump keyword to move the player to different labels.