Applying a transition/animation to a screen on button press
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.
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.
- EJ107
- Newbie
- Posts: 19
- Joined: Mon Feb 01, 2016 8:46 pm
- Projects: Watching Time
- Location: Birmingham, UK
- Contact:
Applying a transition/animation to a screen on button press
Hello! It's been a while since I've had to ask for help here, but I'm struggling to get something working.
Essentially I have a small custom menu on my game that allows the user to enter a "time-travel" mode, where an overlay appears on the screen and they can rewind the game by clicking on certain buttons. This uses image buttons buttons and Ren'py's rollback function.
It all works fine, but I want it to look a little nicer than just having the overlay appear instantly out of nowhere and the scenes instantly change when you click to go back. Having the overlay fade in and being able to use a transition on my rollback calls so that the scenes slide across film-reel style would look a lot nicer, but I can't work out how to apply animations or transitions to a particular screen outside of the script.
If anybody has any ideas or knows of somewhere that already covers this I'd be very grateful!
Essentially I have a small custom menu on my game that allows the user to enter a "time-travel" mode, where an overlay appears on the screen and they can rewind the game by clicking on certain buttons. This uses image buttons buttons and Ren'py's rollback function.
It all works fine, but I want it to look a little nicer than just having the overlay appear instantly out of nowhere and the scenes instantly change when you click to go back. Having the overlay fade in and being able to use a transition on my rollback calls so that the scenes slide across film-reel style would look a lot nicer, but I can't work out how to apply animations or transitions to a particular screen outside of the script.
If anybody has any ideas or knows of somewhere that already covers this I'd be very grateful!
Like my Avatar? Check out: https://www.patreon.com/lackadaisy?ty=h
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Applying a transition/animation to a screen on button pr
You can use the With action. Something like:
[ Show("myscreen"), With(dissolve) ]
[ Show("myscreen"), With(dissolve) ]
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
- EJ107
- Newbie
- Posts: 19
- Joined: Mon Feb 01, 2016 8:46 pm
- Projects: Watching Time
- Location: Birmingham, UK
- Contact:
Re: Applying a transition/animation to a screen on button pr
Thank you for responding. The way my code currently works doesn't actually create any new screens but places the objects I need in existing screens, because I could never get my own screens to display correctly.
An example of what I could never get working is below:
The ShowScreen action is assigned to a button and runs when it is pressed, but the screen never actually appears.
An example of what I could never get working is below:
Code: Select all
screen test_screen():
hbox:
imagebutton xalign 0.5 yalign 0.5:
idle Transform(im.Alpha("ui/text_box.png", 0.85), size=(500, 500))
...
init -2 python:
class ShowScreen(Action):
def __call__(self):
Show("test_screen")
Like my Avatar? Check out: https://www.patreon.com/lackadaisy?ty=h
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Applying a transition/animation to a screen on button pr
If you want to create your own action that calls another action, you can do:
(It's probably better to just use Show directly, however.)
Code: Select all
init -2 python:
class ShowScreen(Action):
def __call__(self):
renpy.run(Show("test_screen"))
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
- EJ107
- Newbie
- Posts: 19
- Joined: Mon Feb 01, 2016 8:46 pm
- Projects: Watching Time
- Location: Birmingham, UK
- Contact:
Re: Applying a transition/animation to a screen on button pr
Thanks a lot, I've got something that I'm pretty happy with now =)
Like my Avatar? Check out: https://www.patreon.com/lackadaisy?ty=h
Who is online
Users browsing this forum: No registered users