Page 1 of 1

animated graphic timer using screens?

Posted: Sat Oct 05, 2019 9:37 am
by bloobeary
So, here's my situation - I'm trying to create a graphical countdown timer.

I have a sequence of PNG images of an LED timer unit, with each image representing one second of the countdown. I've found that I can turn these into an animated graphic by defining them in script.rpy as an image, thusly:

image greentimer60:
size(300,300)
"timers/60sec-green/green60-01.png"
pause 1
"timers/60sec-green/green60-02.png"
pause 1
"timers/60sec-green/green60-03.png"
pause 1
"timers/60sec-green/green60-04.png"

...and so on

The problem is that I would like this timer to remain onscreen across multiple scene changes.
If I just use:

show greentimer60

...then the timer graphic will disappear as soon as the first scene transition happens.

So, I thought maybe I could make it into a screen, since screens can persist across multiple scenes, but at the moment I can't figure out a way to do that. It doesn't appear that I can simply call the existing graphic into a screen:

screen demotimer():
fixed:
add greentimer60

...because this results in a "greentimer60 not defined" error. And copying the defining image code from script.rpy to screens.rpy didn't seem to work either.

Is there a way to actually do this?

Re: animated graphic timer using screens?

Posted: Sat Oct 05, 2019 9:48 am
by xavimat
Try:

Code: Select all

add "greentimer60"

Re: animated graphic timer using screens?

Posted: Sat Oct 05, 2019 12:56 pm
by bloobeary
Yep. That worked, thanks!