I'm niya in charge of the 5th day of Kinki University Advent Calendar 2019. This time, I made a game with Ren'py that introduces the Ikoma Festival that is held every year at Kinki University, so I wish I could share the grammar I learned at that time.
The deliverables can be found at the following url. https://drive.google.com/drive/u/2/folders/1CVx17S12MDS8VLIsH4Q2Iu4C5U93vYC_
Also, github is below. https://github.com/niya1123/Short-Novel/tree/dev
This time, the DL of Ren'py itself and how to create a project are introduced in ** Previous article **, so look there. Please go.
To write a line, follow the steps below.
Specifically, it is as follows.
script.rpy
#Character definition define character name= Character("Character name", color="Set color in hexadecimal")
#It is recommended to define the character name immediately after define with one character or a shortened name of the character name..
#color is the color of the character name displayed in the text box.
define character = Character("character", color="#c8ffc8")
#When the game starts, it starts from label start.
label start:
#Short name of the character"Dialogue"でDialogueの表示
character "Hello!"
#I have to set the character name,Narration.
"It is narrated Hello"
#End of label with return.
return
Set the character image as follows.
script.rpy
#Abbreviation
label start:
show character default
with fade
character "Hello!"
return
What you should pay attention to here is the character string after show. Here, the image is displayed by specifying the file name of any image.
And there is a recommended naming convention for image names, for example bg green.jpg (Bg Green.jpg is also acceptable)
where "bg" is the tag and "green" is the attribute. Other possible names are as follows.
script.rpy
#bg is the tag and green and house are the attributes
show bg green house
Also, if images with the same tag are specified at the same time, the last specified image will be displayed.
Next, there is with fade
, which is a transition.
Please refer to the following for details (because there are many).
https://ja.renpy.org/doc/html/quickstart.html#transitions
You can use python scripts (python2 series) in Ren'py. Although it has not been officially announced yet, there is a possibility that 3 series python can be used in the future. (Reference: https: // twitter .com / renpytom / status / 1196203607252709376? s = 20)
Then, I will explain how to use it.
script.rpy
default flag = False
label start:
menu:
"Do you want to convey your feelings?"
"Yes":
$ flag = True
"No":
jump flag
return
label flag:
if not flag:
"Bad End"
else:
"Good End"
return
Various new elements have come out. I will explain them in order.
First, there is a default statement, which is for initializing the variable you want to use before the start label. It is not necessary, but in that case, if you use a variable in the label, Flase will be automatically added as the initial value.
Then there is the menu inside the start label.
script.rpy
Abbreviation
menu:
"Choose an option"
"Yes":
jump yes
"No":
jump no
The usage is like this, it is not necessary to have a narration part. " Choice ":
I will write it. Then you can indent and write the process. This area is the same as python You can set jump to jump label name you want to skip
, and the process will jump to the label you want to jump, and when that label ends with return, the process will return again.
Next, $ flag = True
, but you can write python code with only one line after $.
If you want to write code over multiple lines, you can write:
script.rpy
python:
life = 100
damage = 50
my_life = life - damage
Next is the if statement. The if statement can be used as it is without using $ or python.
If you keep the above basics in mind, you can also make novel games using Ren'py !!!!
From here on, it's a little application.
First, let's change the default startup screen of Ren'py.
The default screen looks like this.
Let's set the blue test in the lower right to Ren'py and the color to orange (# f59e11). -store.s3.ap-northeast-1.amazonaws.com/0/274354/ee736739-8a81-6410-56f6-9db2ed2cf0e8.png)
The points to change are as follows.
options.rpy(Around the 16th line)
define config.name = _("test")
#Change this to
define config.name = _("Ren'py")
gui.rpy(Around line 28)
define gui.accent_color = '#0099cc'
#Change this to
define gui.accent_color = '#f59e11'
Then change the image of the menu.
gui.rpy(Around line 96)
define gui.main_menu_background = "gui/main_menu.png "
#Change this to
define gui.main_menu_background = "gui/main_susuki.png "
If you change it, it will be like this. (This time the image size does not match, but let's match the image to the size of the game in production)
To be honest, I've broken a lot, but basically, if you understand this far, I think you can make as many deliverables as you made. Everyone, please try to make something with Ren'py!
https://ja.renpy.org/doc/html/index.html
Recommended Posts