Skip to content

Instantly share code, notes, and snippets.

View renpytom's full-sized avatar

Tom Rothamel renpytom

View GitHub Profile
@renpytom
renpytom / hour.rpy
Created August 22, 2012 19:02
Ren'Py Examples
screen hour:
$ filename = "{0}.png".format(hour)
add filename xalign 1.0 yalign 0.0
label start:
$ hour = 12
show screen hour
screen hourtime:
frame:
background "timebox.png"
xminimum 200 # width and height of timebox.png
yminimum 100
xalign 0.915
yalign 0.036
text "[hour]" size 38 xalign 0.5 yalign 0.5 text_align 0.5
screen switch_language:
vbox:
textbutton "Normal" action Language(None)
textbutton "Translated" action Language("test")
# The game starts here.
label start:
show screen switch_language
image steve left topless = "..."
image steve right topless = "..."
image steve left jacket = "..."
image steve right jacket = "..."
label start:
show steve right jacket
"Showing steve right jacket"
frame:
has hbox xfill True xmaximum 600
label "Label"
hbox:
xalign 1.0
textbutton "B"
textbutton "C"
init python:
def transition_callback(kind, interact=True, **kwargs):
if interact and type == 'begin':
renpy.transition(dissolve, layer='master')
config.all_character_callbacks.append(transition_callback)
screen main_menu:
imagemap:
ground "main ground"
hover "main hover"
hotspot (0, 0, 100, 100) action Start()
# ...
The code:
label start:
scene bg washington
show eileen vhappy
e "Hello, world."
show eileen happy
screen battle:
hbox:
xalign 0.5
yalign 0.5
button action Return(0):
xminimum 250 xmaximum 250
yminimum 50 ymaximum 50
hbox xalign 0.5 yalign 0.5:
xfill True
# You can place the script of your game in this file.
# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"
# Declare characters used by this game.
init: