Let's create the first story
Author: NingNing
Last update: 2022-05-20
First of all, this is what you will see in the native sctipt.rpy after creating a project and you can delete they completely
# The script of the game goes in this file.
# Declare characters used by this game. The color argument colorizes the
# name of the character.
define e = Character("Eileen")
# The game starts here.
label start:
# Show a background. This uses a placeholder by default, but you can
# add a file (named either "bg room.png" or "bg room.jpg") to the
# images directory to show it.
scene bg room
# This shows a character sprite. A placeholder is used, but you can
# replace it by adding a file named "eileen happy.png" to the images
# directory.
show eileen happy
# These display lines of dialogue.
e "You've created a new Ren'Py game."
e "Once you add a story, pictures, and music, you can release it to the world!"
# This ends the game.
return
Once we've deleted them all, let's start creating a new story!
Label Statement
- Before a new story starts, you can mark up the plot that belongs together (something like Tags)
Something about label
- A Label can be used multiple times
- label start can not be deleted - Without it Renpy won't work properly
- After each label XX (label's name) you need to add a ":"
- Every label has to be unique
So let's start with label start !
label start:
Create the first conversation
It's very simple to display a conversation in Renpy --> by typing ""
- The words between 2 "" are all words the player can see
So let's write the first conversation now!
"Hello~ Nice to meet you!"
Add Characters / Define Characters
It's not going to show the character's name to the player if we only write "Hello~ Nice to meet you!"
So when we want the character name to appear in the dialog box, we have to put the short name
of the character name in front of ""
like this:
- N "Hello~ Nice to meet you!"
But now renpy can still not display the character's name properly, because Renpy doesn't know this short name
"n" yet, so we're going to define the name first
The statement used to define the character is define
So the code that defines the character will look like this:
define n = Character('NingNing')
NingNing = Name that the player can acutally see
n =
short name
of this characterso every time I type
n
before""
, the player will see NingNing in the namebox
Now let's define 2 characters!
define a = Character("Char A")
define b = Character("Char B")
So now we have 2 characters ٩(ˊᗜˋ) و
Dialogue
Now that we know how to show the plot and we also have 2 characters,
Let's create dialogues with this 2 characters
a "Hello, hello~ The weather is really nice today~"
b "Yes! I really want to go out and play!"
Use Image
There is always something missing without having images in a game
So let's add some images!
First, put the images you want to use in the "images" folder
Usually I will add some subfolders in the images folder
Like this:
You can make as much subfolders as you like
For example you can add the following things in "bg(background) folder":
- Protagonist's room
- School
- Park ...etc.
You can also divide folders like this:
- Character 1
- Character 2
- Character 3 ...etc.
Define Images
It's not really necessary, but I'll still define the image first (sometimes I'll have several images with the same name, and I'll define each one to make sure Renpy is using the right one)
Syntax for defining a image: --> image image_code = "image's path"
Example:
- image park = "images/bg/park.jpg"
Now that you know how to define a image, let's define more images!
image park = "images/bg/park.jpg"
image cha = "images/characters/a.png"
image chb = "images/characters/b.png"
Add Sprites
Now that we have defined the character image so we can that our character enter the scene now!
Here we use show
show cha
Example video --> https://youtu.be/44O-6SOBwkw
It's like you can see now 2 pictures are overlapped so the next thing we're going to do is specify the location of the pictures
Specify position
You can specify that the sprite appears on the left, right, or in the middle, or you can define other locations yourself
So if you want one to appear on the left and the other on the right you can use this code:
show cha at left
show chb at right
Example video --> https://youtu.be/bdsL_ChFb7A
Like this the images are not overlapped now!
Add Background
Since we just defined the image park, let's use the park as our background now!
We use scene
to add our background
So the code will look like this:
scene park
Let a character disappear
You can use hide
if you want to get a single character out of the scene
- hide xx(short name of the image)
Example:
hide cha
So the character with short name cha
will disappear now
Let all the characters exit
If you want all the sprites to disappear, you can use scene
I mentioned before
Example:
scene park
So now we have all basic function to create a simple visual novel!
If you have question or any problem, you can refer to my previous articles or drop me a message!
This post is over now~ You can give me / my website a clap if this help you! My website --> https://spaceofningningen.blogspot.com/ Thank you for your support~