Greetings,Okay, continuing where I
left off. I'm still trying to create a good-looking main window for a cyberpunk-styled fiction piece of mine, which in my understanding involves placing both text and graphics inside a stylised computer monitor. I thought about using a fixed background, which is that of said monitor (
monitor.jpg) on a layer of its own (
monitor), and to display all game graphics (Characters, Background, etc.) atop of it, and realized it with code like that:
Code:
init python:
config.layers.insert(0, 'monitor') # Creating a layer for underlying image of a computer monitor
config.layer_clipping['master'] = (100, 100, 600, 400) # Defining area for master graphics area
init:
image monitor = "monitor.jpg" # Defining the Displayable for image of a computer monitor
label start:
scene monitor onlayer terminal # Displaying the background of a computer monitor
<Rest of game code here>
return
And it worked. But then I remembered that them old monitors used line scan, due to which anything displayed on it looked as if striped. I can give an example, which is the
Fallout 3 hacking screen - if you look closely, you will notice them scanlines. So I decided to implement that effect somehow in my project; I remembered that in another Ren'Py game,
"Digital: A Love Story", I saw that effect
implemented nicely, so I though about analysing its code, but since it is such a complicated game my brain bled too much and I gave up.
So, my first question would be whether anyone smarter than me could create a nice Ren'Py cookbook entry about making a TV scanlines effect ^_^But, being a bit stubborn, I tried to tinker with Ren'Py and find a solution of my own. I devised an algorythm (which didn't work as I expected, though), which involves creating another layer (
scanlines), on which a transparent image with scanlines would be displayed (
scanlines.png), overlaying all underlying layers. The code is as follows:
Code:
init python:
config.layers.insert(0, 'monitor') # Creating a layer for underlying image of a computer monitor
config.layer_clipping['master'] = (100, 100, 600, 400) # Defining area for master graphics area
config.layers.insert(1, 'scanlines') # Creating a layer for overlaying image of TV scanlines
config.layer_clipping['scanlines'] = (100, 100, 600, 400) # Defining the area to overlay with the image of TV scanlines
config.layers = ['monitor', 'master', 'transient', 'screens', 'overlay', 'scanlines'] # Putting the scanlines to the most overlaying layer
init:
image monitor = "monitor.jpg" # Defining the Displayable for image of a computer monitor
image scanlines = "scanlines.png" # Defining the Displayable for image of TV scanlines
label start:
scene monitor onlayer terminal # Displaying the background of a computer monitor
scene scanlines onlayer scanlines # Displaying the overlaying scanlines
<Rest of game code here>
return
And it worked, kind of. Scanlines overlayed the graphics and text nicely, making it look as if both game graphics and text are printed on my stylized "computer monitor".
But then I suddenly found out that scanlines overlayed not only the graphics area, but all game menus - pause, save, load, preferences, etc., - rendering them useless. So I tried to locate on which layer the menus were rendered, and identified it as
'screens'; so by changing the code from
Code:
config.layers = ['monitor', 'master', 'transient', 'screens', 'overlay', 'scanlines'] # Putting the scanlines to the most overlaying layer
to
Code:
config.layers = ['monitor', 'master', 'transient', 'scanlines', 'screens', 'overlay'] # Putting the scanlines atop the graphics but below the menus
I managed to get scanlines off the menus; but the drawback was that it disappeared from over the text, too, which means that text is rendered on
'screens' layer too!
I wanted the scanlines to overlay the text but stay off the menus, so I tried to create a new layer (
'textarea') for the text and put it below the
'scanlines' layer, while
'screens' layer remained atop, by editing the
screens.rpy.
But there I did'n find any statement which states on which layer the ADV-style text should be rendered! I tried to add the 'onlayer textarea' statement here and there, like:
Code:
screen say:
<Smart config stuff here>
# Decide if we want to use the one-window or two-window varaint.
if not two_window:
# The one window variant.
window:
id "window"
has vbox:
style "say_vbox"
if who:
text who id "who" onlayer textarea
text what id "what" onlayer textarea
else:
<More smart config stuff here>
but it always resulted in an error:Code:
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
On line 27 of D:\Games\DR Test Project/game/screens.rpy: u'onlayer' is not a keyword argument or valid child for the text statement.
text who id "who" onlayer textarea
^
Ren'Py Version: Ren'Py 6.12.0e
So if nobody could write a cookbook article for TV scanlines effect, then
my second question is as following: could I re-define on which layer the ADV-style text frames should be rendered while leaving menu screens on their pre-defined 'screens' layer?Thanks for you effort and my sicnerest apologies for writing such a long and brain-exhausting post,
--
S.