television lines effect

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Wanda Siren
Newbie
Posts: 9
Joined: Wed Sep 19, 2018 5:18 pm
itch: wanda-siren
Contact:

television lines effect

#1 Post by Wanda Siren » Sun Oct 07, 2018 12:28 pm

hello there, first time i'm posting here.

i was wondering, is it possible to add a filter on top of the screen (including gui and textbox) to simulate a old tv screen?

i searched the forum but i didn't find any doable solution.

thanks in advance

User avatar
lil steffi
Newbie
Posts: 8
Joined: Sun Oct 07, 2018 1:12 pm
Contact:

Re: television lines effect

#2 Post by lil steffi » Sun Oct 07, 2018 2:12 pm

you could just do a transparent png animation and layer that on top of your scene!

User avatar
Wanda Siren
Newbie
Posts: 9
Joined: Wed Sep 19, 2018 5:18 pm
itch: wanda-siren
Contact:

Re: television lines effect

#3 Post by Wanda Siren » Sun Oct 07, 2018 5:43 pm

i just created a custom screen and added my file but nothing is showing

sorry i'm not very flexible with screens

User avatar
Imperf3kt
Eileen-Class Veteran
Posts: 1940
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: television lines effect

#4 Post by Imperf3kt » Sun Oct 07, 2018 6:24 pm

Wanda Siren wrote:
Sun Oct 07, 2018 5:43 pm
i just created a custom screen and added my file but nothing is showing

sorry i'm not very flexible with screens
If you are able to show how you did so, we may be able to point out what went wrong.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

User avatar
lil steffi
Newbie
Posts: 8
Joined: Sun Oct 07, 2018 1:12 pm
Contact:

Re: television lines effect

#5 Post by lil steffi » Sun Oct 07, 2018 9:49 pm

I guess if you wanted to do a frame animation of the tv, you could treat it as a layer like this:


#define animations

image TVWarp:
"image1.png"
pause .5
"image2.png"
pause .5
"image3.png"
pause .5
repeat

#define your background

image your_background = "background.png"

#call the animations within whatever you're going to label it

label whatever:
scene your_background
show TVWarp



something like that could work for you

User avatar
Wanda Siren
Newbie
Posts: 9
Joined: Wed Sep 19, 2018 5:18 pm
itch: wanda-siren
Contact:

Re: television lines effect

#6 Post by Wanda Siren » Mon Oct 08, 2018 8:59 am

Imperf3kt wrote:
Sun Oct 07, 2018 6:24 pm

If you are able to show how you did so, we may be able to point out what went wrong.

Code: Select all

screen over_image:

    zorder 300

    add "gui/overlay/static.png"
i only wrote this line of code over the other codes in screens.rpy, but i'm stuck

lil steffi wrote:
Sun Oct 07, 2018 9:49 pm
I guess if you wanted to do a frame animation of the tv, you could treat it as a layer like this:


#define animations

image TVWarp:
"image1.png"
pause .5
"image2.png"
pause .5
"image3.png"
pause .5
repeat

#define your background

image your_background = "background.png"

#call the animations within whatever you're going to label it

label whatever:
scene your_background
show TVWarp



something like that could work for you

wait, i meant like an image that stays on top of the screen for the rest of the game, even when you open the main menu or the settings

i'm not sure labels can do that, correct me if i'm wrong

User avatar
Donmai
Eileen-Class Veteran
Posts: 1774
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question
Projects: Slumberland
Location: Brazil
Contact:

Re: television lines effect

#7 Post by Donmai » Mon Oct 08, 2018 11:05 am

You can create a new layer and show your image there.

Code: Select all

image scanlines = "images/your image.png"

Code: Select all

init python:
    config.layers = [ 'master', 'mask', 'transient', 'screens', 'overlay' ]

Code: Select all

label start:
    
    show scanlines onlayer mask
    rest of your game...
See here: viewtopic.php?f=8&t=20699

You can also experiment with alpha and/or additive values to fine-tune the effect. For example:

Code: Select all

image scanlines:
    "images/your image.png"
    additive .5
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
Wanda Siren
Newbie
Posts: 9
Joined: Wed Sep 19, 2018 5:18 pm
itch: wanda-siren
Contact:

Re: television lines effect

#8 Post by Wanda Siren » Mon Oct 08, 2018 12:20 pm

Donmai wrote:
Mon Oct 08, 2018 11:05 am
You can create a new layer and show your image there.

Code: Select all

image scanlines = "images/your image.png"

Code: Select all

init python:
    config.layers = [ 'master', 'mask', 'transient', 'screens', 'overlay' ]

Code: Select all

label start:
    
    show scanlines onlayer mask
    rest of your game...
See here: viewtopic.php?f=8&t=20699

You can also experiment with alpha and/or additive values to fine-tune the effect. For example:

Code: Select all

image scanlines:
    "images/your image.png"
    additive .5

okay so, i added your code in my script, and everything works fine, but it's not showing over my gui nor the title screen, am i doing something wrong? sorry for my ignorance

User avatar
Donmai
Eileen-Class Veteran
Posts: 1774
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question
Projects: Slumberland
Location: Brazil
Contact:

Re: television lines effect

#9 Post by Donmai » Tue Oct 09, 2018 8:40 pm

Wanda Siren wrote:
Mon Oct 08, 2018 12:20 pm
am i doing something wrong?
No, you are not. That's how that example really works, sorry.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

TakeHomeTheCup
Newbie
Posts: 15
Joined: Tue Oct 09, 2018 9:12 pm
Contact:

Re: television lines effect

#10 Post by TakeHomeTheCup » Tue Oct 09, 2018 9:30 pm

You can use:

Code: Select all

label before_main_menu:
	show scanlines onlayer mask
	return
Along with that, you can put the layer 'mask' as the last element in the config.layers, like this:

Code: Select all

init python:
    config.layers = [ 'master'', 'transient', 'screens', 'overlay', 'mask' ]
However, even with that, you'll have to put "show scanlines onlayer mask" every time you change the scene, because when that happens, the layer is cleared, and I don't know if there is a way to prevent it from being cleared. Sorry.

User avatar
Wanda Siren
Newbie
Posts: 9
Joined: Wed Sep 19, 2018 5:18 pm
itch: wanda-siren
Contact:

Re: television lines effect

#11 Post by Wanda Siren » Wed Oct 10, 2018 10:09 am

TakeHomeTheCup wrote:
Tue Oct 09, 2018 9:30 pm
You can use:

Code: Select all

label before_main_menu:
	show scanlines onlayer mask
	return
Along with that, you can put the layer 'mask' as the last element in the config.layers, like this:

Code: Select all

init python:
    config.layers = [ 'master'', 'transient', 'screens', 'overlay', 'mask' ]
However, even with that, you'll have to put "show scanlines onlayer mask" every time you change the scene, because when that happens, the layer is cleared, and I don't know if there is a way to prevent it from being cleared. Sorry.
that's exactly what i wanted to do, it even shows on the setting screen!

it's ok if have to declare it every time, thank you very much for your help <3

Post Reply

Who is online

Users browsing this forum: No registered users