I figured out why the transitions didn't work.
Because I used the {fast} tag to display all the text at once, it disabled any following transitions. I decided to use a built-in ParameterizedText object called "text" instead. These objects are treated like images, so they appear all at once, and allow transitions before and after.
Now that the transition problem is solved, all that was left is the text formatting. After reading the renpy source code for the ParameterizedText object, I found out that the renpy parser would accept not just a quoted string, but any python expression that evaluated to a string. Including a function call.
So, here's how it goes:
Code: Select all
label start:
scene black
with slowDissolve # fade from main menu
show text chapterText(number = 1, title = "Early Years") with dissolve
pause
scene black with dissolve
show text bookText(
text = "Tsadikim are motivated [solely] by their good nature, as it is written, \"My heart is a void within me,\" i.e., void of an evil nature....",
author = "Rabbi Shneur Zalmen of Liadi",
title = "Likkutei Amarim") with dissolve
pause
scene black with dissolve
As in regular python, the argument variable names may be left out, if you can remember the order of the arguments in the function definition:
Code: Select all
def bookText(text, author = None, title = None):
if author and title:
return "{i}%s{/i}\n\n- {i}%s{/i}, %s" % (text, author, title)
elif title:
return "{i}%s{/i}\n\n- %s" % (text, title)
elif title:
return "{i}%s{/i}\n\n- {i}%s{/i}" % (text, author)
else:
return "{i}%s{/i}" % text
def chapterText(number = None, title = None):
if not title and not number:
raise Exception("chapterText() requires at least one argument")
if not title:
return "{size=+20}{i}Chapter %d{/i}{/size}" % number
elif not number:
return "{size=+20}{i}%s{/i}{/size}" % title
else: # have both a number and a title
return "{size=+10}{i}Chapter %d{/size}{size=+20}\n\n%s{/i}{/size}" % (number, title)