Animated main/game menus
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.
-
Criptych
Animated main/game menus
I've seen in "Ori, Ochi, Onoe" that the main and game menus are animated when you enter them. But since the script is obfuscated, I can't figure out how you did that, and it's been bugging me. I've tried e.g. adding a MoveTransition containing the widget instead of the adding the widget directly, but all I get is an error. (Actually, it mentions a "curry" class. Is that related to what I'm doing wrong?)
On a related note, is there a way to get a list of files in an RPA, instead of just extracting the one(s) you want; or is that part of the obfuscation?
On a related note, is there a way to get a list of files in an RPA, instead of just extracting the one(s) you want; or is that part of the obfuscation?
- 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:
Here's the modern code for how to declare the O3 style spinning transitions.
Note that it only really works if the various components of the menu screen are positioned absolutely, at the top level of the game. So you'll need to place the buttons using config.main_menu_positions and config.game_menu_positions for this to stand a chance of working.
Code: Select all
def speedup(x):
return x * x
def slowdown(x):
return 1.0 - (1.0 - x) ** 2
def ignore_entering(pos, delay, d):
return None
revolvein = MoveTransition(0.5, enter_factory=RevolveInOut(-90, 0, time_warp=slowdown))
revolveout = MoveTransition(0.5, leave_factory=RevolveInOut(0, 90, time_warp=speedup), enter_factory=ignore_entering)
spinfadein = ComposeTransition(dissolve, after=revolvein)
spinfadeout = ComposeTransition(dissolve, before=revolveout)
spinfadeboth = ComposeTransition(dissolve, before=revolveout, after=revolvein)
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
- 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:
Um... config.enter_transition, config.main_game_transition, and the various other config.*_transition variables.
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
- Criptych
- Regular
- Posts: 87
- Joined: Sat Jun 23, 2007 9:19 am
- Projects: ALICE.NET
- Location: The other end of the internet.
- Contact:
You make it look so easy!!! XD
The same technique could be used for any transition, then? I'd like to have, say, each button drop from behind the one above it.
Would something like that work? Except, looking at the source, I don't think widgets can actually tell you their height...
The same technique could be used for any transition, then? I'd like to have, say, each button drop from behind the one above it.
Code: Select all
def drop_button(pos,delay,d):
start=pos
start.yposition-=d.height
return Move(start,pos,delay,child=d)
config.some_transition = MoveTransition(0.5, enter_factory=drop_button)
- 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:
IIRC, there's a flag to Motion that makes it tell the function that computes the move it's height. I think your code is a bit wrong... IIRC, pos is a tuple, not an object.
But fundamentally, MoveTransition can be used to make all sorts of interesting effects.
But fundamentally, MoveTransition can be used to make all sorts of interesting effects.
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
- Criptych
- Regular
- Posts: 87
- Joined: Sat Jun 23, 2007 9:19 am
- Projects: ALICE.NET
- Location: The other end of the internet.
- Contact:
After a few trials (and errors), I've ended up with the following code:
But I receive this error message:
I understand what the Curry does, but where is it coming from? Does this mean I need to "un-curry" something?
Thanks for all your help, everyone.
Code: Select all
init python:
def drop_button(pos,delay,d):
start=Position(pos[0],0.0)
return MoveTransition(start,pos,delay,child=d)
#...
config.end_splash_transition = MoveTransition(0.5, enter_factory=drop_button)
Code: Select all
File "C:\...\RenPy\renpy\display\core.py", line 208, in visit_all
File "C:\...\RenPy\renpy\display\core.py", line 1347, in <lambda>
AttributeError: 'Curry' object has no attribute 'per_interact'Thanks for all your help, everyone.
- 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:
Um.... you certainly should not be using a MoveTransition in the drop_button function. You'd want to use a Move, instead. I also think that the Position object is wrong... you want to simply use a tuple that gives the position.
(Hm... reading the wiki, this is unclear, so I fixed it.)
I'd write drop_button as:
That's roughly equivalent to MoveIn, BTW.
(Hm... reading the wiki, this is unclear, so I fixed it.)
I'd write drop_button as:
Code: Select all
def drop_button(pos, delay, d, **kwargs):
start = (0, pos[1], pos[2], pos[3])
return Move(start, pos, delay)(d)
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
- Criptych
- Regular
- Posts: 87
- Joined: Sat Jun 23, 2007 9:19 am
- Projects: ALICE.NET
- Location: The other end of the internet.
- Contact:
Duly noted, also changed Position -> tuple.PyTom wrote:You'd want to use a Move, instead.
So it was a matter of un-currying...PyTom wrote:Code: Select all
return Move(start, pos, delay)(d)
Now I have
Code: Select all
def drop_button(pos,delay,d):
start=(pos[0],0.0,pos[2],pos[3])
return MoveIn(start,pos,delay)(d)
- Criptych
- Regular
- Posts: 87
- Joined: Sat Jun 23, 2007 9:19 am
- Projects: ALICE.NET
- Location: The other end of the internet.
- Contact:
I've changed the design a little (mostly aesthetic) and now have:
All the transitions are working fine (if a little slow on my computer) except the transition from main menu to game menu (main_game_transition); it just displays the menu immediately with no transition, while the rest have no problems. Any ideas why this is?
Code: Select all
def enter_button(pos,delay,d):
start=(pos[0],1.0,pos[2],0.0)
return MoveIn(start,pos,delay)(d)
def leave_button(pos,delay,d):
end=(pos[0],1.0,pos[2],0.0)
return MoveOut(end,pos,delay)(d)
slide_button_out =MoveTransition(0.5, leave_factory=leave_button)
slide_button_in =MoveTransition(0.5, enter_factory=enter_button)
slide_button_both=MoveTransition(0.5, leave_factory=leave_button, enter_factory=enter_button)
# ...
config.enter_transition = slide_button_in
config.exit_transition = slide_button_out
config.intra_transition = slide_button_both
config.main_game_transition = slide_button_both
config.game_main_transition = slide_button_both
config.end_splash_transition = slide_button_in
config.end_game_transition = slide_button_in
Who is online
Users browsing this forum: _ticlock_

