0% found this document useful (0 votes)
71 views3 pages

Ren'py Code Learn

This document provides examples of how to: 1) Show images, characters, and transitions between scenes in Ren'Py. It demonstrates using show, hide, and transforms. 2) Play music and sounds at different points in the story. It shows playing, fading, queuing, and stopping audio. 3) Create choices and menus that allow the player to direct the story. Variable usage remembers the player's choices. 4) Interpolate variables, take user input, and change text styles. It also defines characters and transforms images. 5) Add effects like flashing, shaking the screen horizontally and vertically, and adjusting text speed.

Uploaded by

bruhv
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
0% found this document useful (0 votes)
71 views3 pages

Ren'py Code Learn

This document provides examples of how to: 1) Show images, characters, and transitions between scenes in Ren'Py. It demonstrates using show, hide, and transforms. 2) Play music and sounds at different points in the story. It shows playing, fading, queuing, and stopping audio. 3) Create choices and menus that allow the player to direct the story. Variable usage remembers the player's choices. 4) Interpolate variables, take user input, and change text styles. It also defines characters and transforms images. 5) Add effects like flashing, shaking the screen horizontally and vertically, and adjusting text speed.

Uploaded by

bruhv
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 3

define l = Character("Lucy", color="#ffcccc") = letter color

--------------------------------------
label start:

scene bg cave
show lucy happy

l "Now that the lights are on, we don't have to worry about Grues anymore."

show lucy mad at right

l "But what's the deal with me being in a cave? Eileen gets to be out in the
sun, and I'm stuck here!"

show logo base at rightish behind eileen


hide logo base

show eileen happy:


xalign 0.75
yalign 1.0

transform slightleft:
xalign 0.25
yalign 1.0

= show image, specify its place, and hide it, transform is for saving the setting
--------------------------------------------------------------------------------
scene bg whitehouse
with Dissolve(.5)

pause .5

scene bg washington
show eileen happy
with Dissolve(.5)

define slowdissolve = Dissolve(1.0)

= transitions, define is for saving the setting


--------------------------------------------------------------------------------
play music "sunflower-slow-drag.ogg" fadeout 1
queue music "sunflower-slow-drag.ogg"
stop music fadeout 1
play sound "tower_clock.ogg"

= playing music and sounds


--------------------------------------------------------------------------------
menu:

"Yes, I do.":
jump choice1_yes

"No, I don't.":
jump choice1_no

label choice1_yes:
$ menu_flag = True

e "While creating a multi-path visual novel can be a bit more work, it can
yield a unique experience."

jump choice1_done

label choice1_no:

$ menu_flag = False

e "Games without menus are called kinetic novels, and there are dozens of
them available to play."

jump choice1_done

label choice1_done:

# ... the game continues here.

if menu_flag:

e "For example, I remember that you plan to use menus in your game."

else:

e "For example, I remember that you're planning to make a kinetic novel,


without menus."

menu:
e "Finally, this shows how you can show dialogue and menus at the same time.
Understand?"

"Yes.":

e "Great."

"No.":

e "If you look at the example, before the first choice, there's an indented
say statement."

= choices, can use if statement so the game remembers a choice


-----------------------------------------------------------------------------------
----------------------
python:
name = renpy.input("What's your name?")

name = name.strip() or "Guy Shy"

e "To interpolate a variable, write it in square brackets. Isn't that right,


[name]?"

define g = Character("[name]")
$ answer = 42
$ flag = True
e "Variable interpolation also works with other variables. Here, the answer is
[answer] and the flag is [flag]."

= for player input

-----------------------------------------------------------------------------------
--------------------------
e "For example, we might want to have text that is {b}bold{/b}, {i}italic{/i},
{s}struckthrough{/s}, or {u}underlined{/u}."

e "The color text tag changes the {color=#0080c0}color{/color} of the text."

e "The p tag breaks a paragraph,{p}and waits for the player to click."

e "If it is given a number as an argument,{p=1.5}it waits that many seconds."

e "The w tag also waits for a click,{w} except it doesn't break lines,{w=.5}
the way p does."

eslow "The nw tag causes Ren'Py to continue past slow text,{nw}"


with flashbulb
extend " to the next statement."

define e_shout = Character("Eileen", who_color="#c8ffc8", what_size=34)


define e_whisper = Character("Eileen", who_color="#c8ffc8", what_size=18)

define narrator = Character(what_italic=True)

image logo rotated = Transform("logo base", rotate=45)

define flashbulb = Fade(0.2, 0.0, 0.8, color='#fff')

with flashbulb

show bg whitehouse
with fade

play audio "punch.opus"


with vpunch

play audio "punch.opus"


with hpunch

= change text style, shout and whisper, define narrator, rotate image, define
flashbulb, shake screen horizontally
with hpunch and vertically with vpunch

You might also like