How to make an "animation" appear on the main menu after clicking a button?
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.
- LilyValley98
- Newbie
- Posts: 10
- Joined: Sat Jul 24, 2021 3:15 pm
- Contact:
How to make an "animation" appear on the main menu after clicking a button?
Can you make an "animation" appear in the main menu by clicking a button in the main menu? It's an animation that appears somewhere on the main menu with two images cycling back and forth. I know how to make this in the script but I don't know how to do this in the main menu itself.
Last edited by LilyValley98 on Sun Aug 08, 2021 11:49 am, edited 1 time in total.
New to Ren'Py with No Thoughts, Head Empty.
- Träumer
- Newbie
- Posts: 4
- Joined: Fri Jun 11, 2021 2:00 pm
- Projects: Hearts and Hexes
- Discord: Träumer#5470
- Contact:
Re: How to make an "animation" appear on the main menu after clicking a button
you can make a screen and call it like that: In screens.rpy under screen navigation(where the other menubuttons are); textbutton "Animation" action ShowMenu ("AnimationScreen")
Re: How to make an "animation" appear on the main menu after clicking a button
Try it like - https://www.renpy.org/doc/html/screens. ... -statementLilyValley98 wrote: ↑Fri Jul 30, 2021 2:14 pm Can you make an "animation" appear in the main menu by clicking a button in the main menu?...
- LilyValley98
- Newbie
- Posts: 10
- Joined: Sat Jul 24, 2021 3:15 pm
- Contact:
Re: How to make an "animation" appear on the main menu after clicking a button
Thank you for explaining! Unfortunately, it didn't work.
New to Ren'Py with No Thoughts, Head Empty.
- Träumer
- Newbie
- Posts: 4
- Joined: Fri Jun 11, 2021 2:00 pm
- Projects: Hearts and Hexes
- Discord: Träumer#5470
- Contact:
Re: How to make an "animation" appear on the main menu after clicking a button
Why dosen´t it work?
- LilyValley98
- Newbie
- Posts: 10
- Joined: Sat Jul 24, 2021 3:15 pm
- Contact:
Re: How to make an "animation" appear on the main menu after clicking a button
This is the button that I want to be clicked and then show that animation:
Code: Select all
imagebutton auto "UI/signature_%s.png" xpos 5 ypos 690 action showMenu("AnimationScreen", transition= slowdissolve)
Code: Select all
screen AnimationScreen():
xpos 50
ypos 700
image "cat hand up.png"
pause 0.5
image "cat hand down.png"
pause 0.5
repeat
for example:
Code: Select all
File "game/script.rpy", line 25: u'xpos' is not a keyword argument or valid child for the screen statement.
I've tried other stuff such as using transform but I just don't get how to use it.
I still tried though:
Code: Select all
transform AnimationScreen:
screen AnimationScreen:
xpos 50
ypos 700
image "cat hand up.png"
pause 0.5
image "cat hand down.png"
pause 0.5
repeat
Code: Select all
File "game/cat screen.rpy", line 2: ATL statement contains two expressions in a row; is one of them a misspelled property? If not, separate them with pass.
screen AnimationScreen:
^
New to Ren'Py with No Thoughts, Head Empty.
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Contact:
Re: How to make an "animation" appear on the main menu after clicking a button
that's not a valid screen. what you're doing is supposed to be ATL which is different from the syntax of a screen.
What I can suggest is to use showif statements and trigger a variable.
What I can suggest is to use showif statements and trigger a variable.
Code: Select all
transform show_anim:
on show:
alpha 0.0
easein 0.25 alpha 1.0
on hide:
easeout 0.25 alpha 0.0
screen test():
default showing = False
textbutton "Press" action ToggleScreenVariable("showing")
showif showing:
add "some image" at show_anim
- LilyValley98
- Newbie
- Posts: 10
- Joined: Sat Jul 24, 2021 3:15 pm
- Contact:
Re: How to make an "animation" appear on the main menu after clicking a button
The game starts and I click the image button but it resorts in an error:hell_oh_world wrote: ↑Wed Aug 04, 2021 7:17 am that's not a valid screen. what you're doing is supposed to be ATL which is different from the syntax of a screen.
What I can suggest is to use showif statements and trigger a variable.Code: Select all
transform show_anim: on show: alpha 0.0 easein 0.25 alpha 1.0 on hide: easeout 0.25 alpha 0.0 screen test(): default showing = False textbutton "Press" action ToggleScreenVariable("showing") showif showing: add "some image" at show_anim
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "renpy/common/00action_data.rpy", line 356, in __call__
value = cs.scope[self.name]
KeyError: u'showing'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
python hide:
File "renpy/ast.py", line 922, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "renpy/python.py", line 2218, in py_exec_bytecode
exec(bytecode, globals, locals)
File "renpy/common/_layout/screen_main_menu.rpym", line 28, in <module>
python hide:
File "renpy/common/_layout/screen_main_menu.rpym", line 35, in _execute_python_hide
ui.interact()
File "renpy/ui.py", line 298, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "renpy/display/core.py", line 3006, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, **kwargs)
File "renpy/display/core.py", line 3815, in interact_core
rv = root_widget.event(ev, x, y, 0)
File "renpy/display/layout.py", line 1027, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "renpy/display/layout.py", line 1027, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "renpy/display/layout.py", line 1027, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "renpy/display/screen.py", line 720, in event
rv = self.child.event(ev, x, y, st)
File "renpy/display/layout.py", line 1027, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "renpy/display/layout.py", line 1027, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "renpy/display/behavior.py", line 969, in event
return handle_click(self.clicked)
File "renpy/display/behavior.py", line 904, in handle_click
rv = run(action)
File "renpy/display/behavior.py", line 323, in run
return action(*args, **kwargs)
File "renpy/common/00action_data.rpy", line 356, in __call__
value = cs.scope[self.name]
KeyError: u'showing'
Windows-7-6.1.7601-SP1
Ren'Py 7.4.1.1270
Summer Love 1.0
Wed Aug 4 22:44:57 2021
Code: Select all
imagebutton auto "UI/signature_%s.png" xpos 5 ypos 690 action ToggleScreenVariable("showing") hovered [ Play("sound", "audio/click.wav") ]
Code: Select all
transform show_anim:
on show:
alpha 0.0
easein 0.25 alpha 1.0
on hide:
easeout 0.25 alpha 0.0
screen cat():
default showing = False
showif showing:
add "cat hand up.png" at show_anim
This a better version of what I was trying to do:
New to Ren'Py with No Thoughts, Head Empty.
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Contact:
Re: How to make an "animation" appear on the main menu after clicking a button
the `showing` variable should be on the same screen as the button. and of course, the `showing` variable is only accessible to the screen where it is declared.
to avoid issues regarding the global accessibility of the variable, make it a global variable instead, and perhaps a persistent one?
to avoid issues regarding the global accessibility of the variable, make it a global variable instead, and perhaps a persistent one?
Code: Select all
default persistent.showing = False
screen test():
textbutton "Press" action ToggleVariable("persistent.showing")
showif showing:
add "some image" at show_anim
- LilyValley98
- Newbie
- Posts: 10
- Joined: Sat Jul 24, 2021 3:15 pm
- Contact:
Re: How to make an "animation" appear on the main menu after clicking a button
Same error but now changed to KeyError: u'persistent.showing'hell_oh_world wrote: ↑Wed Aug 04, 2021 11:49 am the `showing` variable should be on the same screen as the button. and of course, the `showing` variable is only accessible to the screen where it is declared.
to avoid issues regarding the global accessibility of the variable, make it a global variable instead, and perhaps a persistent one?Code: Select all
default persistent.showing = False screen test(): textbutton "Press" action ToggleVariable("persistent.showing") showif showing: add "some image" at show_anim
I moved the whole code to the screens.rpy and I also tried putting the image button the way you wrote it but it just didn't appear in the main menu, the only way I can make the button appear is if I put it under 'if main_menu:' in screens.rpy
New to Ren'Py with No Thoughts, Head Empty.
Who is online
Users browsing this forum: Ahrefs [Bot]