Basically, the code allows you to do this:
It uses Alpha Masks to add lighting or shadows on top of sprites. Similar to a noir film.
Tutorial script I used:
Code: Select all
define s = Character("Sylvie")
transform easeinleft_transform:
offscreenleft
easein 1.0 left
transform easeinright_transform:
offscreenright
easein 1.0 right
transform gocenter_transform:
easein 1.0 center
transform centertoleft_transform:
center
easein 1.0 left
transform centertoright_transform:
center
easein 1.0 right
# The game starts here.
label start:
scene room_morning_light_on
s "You've created a new Ren'Py game."
s "You see this background? It's called \"room morning light on.\" It's by Uncle Mugen."
#show expression AlphaMask("shadows", At("older man normal", easeinleft_transform)) as mask
show sylvie blue normal at easeinleft_transform
show expression AlphaMask("shadows", At("sylvie blue normal", easeinleft_transform)) as mask
s "I'm Sylvie."
show sylvie blue normal at gocenter_transform
show expression AlphaMask("shadows", At("sylvie blue normal", gocenter_transform)) as mask
s "I was in the Ren'Py tutorial game, \"The Question.\""
s "Today, I'm using this video to show you how to use Alpha Masks in your Ren'Py visual novel."
s "A sort of tutorial. I'll post a link to the script I'm using in the video's description."
show sylvie blue normal at centertoleft_transform
show expression AlphaMask("shadows", At("sylvie blue normal", centertoleft_transform)) as mask
s "Did you know you can create a cool noir lighting effect? All you need is a png image with shadows..."
show expression AlphaMask("light", At("sylvie blue normal", left)) as mask with dissolve
s "Or coloured light."
show sylvie blue normal at gocenter_transform
show expression AlphaMask("light", At("sylvie blue normal", gocenter_transform)) as mask
s "The Alpha Mask keeps the shadows and light only on me, rather than on the background."
show expression AlphaMask("shadows", At("sylvie blue normal", center)) as mask
s "They have to be semi-transparent..."
show expression AlphaMask("hardshadows", At("sylvie blue normal", center)) as mask with dissolve
s "Or you can use solid shadows for a super-noir, black and white look."
show expression AlphaMask("shadows", At("sylvie blue normal", center)) as mask with dissolve
s "The shadows look like window blinds, right?"
show sylvie blue normal at centertoright_transform
show expression AlphaMask("shadows", At("sylvie blue normal", centertoright_transform)) as mask
s "I can walk around..."
show sylvie green giggle
show expression AlphaMask("shadows", At("sylvie green giggle", right)) as mask
s "I can even turn and change my sprite seamlessly!"
s "Hope this helps!"
return