How to Make Things that Appear on Hovered Imagebutton Appear with 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
ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

How to Make Things that Appear on Hovered Imagebutton Appear with Effect...?

#1 Post by ArizaLuca »

On my main menu screen, when I hover on an imagebutton, things appear when an imagebutton is hovered over-- I would like the thing that appears to appear on a dissolve or slowly rather than just blinking into existence. My current code is this:

Code: Select all

screen main_menu:
    tag menu 
    
    add "mainmenubganimated" 
    
    $ y=0
    
    imagebutton auto "images/mainmenu_start_%s.png" xpos 0 ypos y focus_mask True action Start() hovered [Show("gui_mainmenu", my_picture="images/mainmenu ri hover.png", my_tt_xpos=0, my_tt_ypos=0) ] unhovered [Hide("gui_mainmenu")] at main_eff1
    $ y+=50
    if persistent.epilogue == True:
        imagebutton auto "images/mainmenu_load_%s.png" xpos 0 ypos y focus_mask True action ShowMenu('load') hovered [ Show("gui_mainmenu", my_picture="images/mainmenu ri_old_hover.png", my_tt_xpos=0, my_tt_ypos=0) ] unhovered [Hide("gui_mainmenu")] at main_eff2
    else:
        imagebutton auto "images/mainmenu_load_%s.png" xpos 0 ypos y focus_mask True action ShowMenu('load') hovered [ Show("gui_mainmenu", my_picture="images/mainmenu ri_old_hover_full.png", my_tt_xpos=0, my_tt_ypos=0) ] unhovered [Hide("gui_mainmenu")] at main_eff2
    $ y-=50
    imagebutton auto "images/mainmenu_settings_%s.png" xpos -30 ypos y focus_mask True action ShowMenu('preferences') hovered [ Show("gui_mainmenu", my_picture="images/mainmenu gray.png", my_tt_xpos=0, my_tt_ypos=0) ] unhovered [Hide("gui_mainmenu")] at main_eff3
    ##imagebutton auto "images/mainmenu_extras_%s.png" xpos 0 ypos y focus_mask True action Start('extras') hovered [ Show("gui_mainmenu", my_picture="images/mainmenu obsidianassassin hover.png", my_tt_xpos=0, my_tt_ypos=0) ] unhovered [Hide("gui_mainmenu")] at main_eff4
    $ y-=90
    imagebutton auto "images/mainmenu_quit_%s.png" xpos 0 ypos y focus_mask True action Quit(confirm=True) hovered [ Show("gui_mainmenu", my_picture="images/none.png", my_tt_xpos=0, my_tt_ypos=0) ] unhovered [Hide("gui_mainmenu")] at main_eff5

# The code below defines the ATL transform effects for each button on the main menu. These effects are triggered when the buttons are shown.
# ATL transform properties: http://www.renpy.org/wiki/renpy/doc/reference/Animation_and_Transformation_Language#Transform_Properties
#begin main_eff
init -2:
    transform main_eff1:
        alpha 0.0
        easein 0.8 alpha 1.0
    transform main_eff2:
        alpha 0.0
        easein 1.0 alpha 1.0
    transform main_eff3:
        alpha 0.0
        easein 1.2 alpha 1.0
    transform main_eff4:
        alpha 0.0
        easein 1.4 alpha 1.0
    transform main_eff5:
        alpha 0.5
        easein 1.6 alpha 1.0
Please let me know if there's a way to achieve that effect! Thank you!

User avatar
Andredron
Miko-Class Veteran
Posts: 718
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: How to Make Things that Appear on Hovered Imagebutton Appear with Effect...?

#2 Post by Andredron »

init:
....transform ggg:
........
........
.......repeat

ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

Re: How to Make Things that Appear on Hovered Imagebutton Appear with Effect...?

#3 Post by ArizaLuca »

... Please explain further than that. I don't really know coding. I mostly just used an imagebutton tutorial to get the rest of it.

User avatar
Andredron
Miko-Class Veteran
Posts: 718
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: How to Make Things that Appear on Hovered Imagebutton Appear with Effect...?

#4 Post by Andredron »

ArizaLuca wrote: Fri Sep 14, 2018 5:19 pm ... Please explain further than that. I don't really know coding. I mostly just used an imagebutton tutorial to get the rest of it.

Code: Select all

init -2:
    transform main_eff1:
        alpha 0.0
        easein 2.0 alpha 1.0
        alpha 1.0
        easein 2.0 alpha 0.0
        repeat
        
screen ....:
.....
....
....imagebutton ........ at main_eff1

ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

Re: How to Make Things that Appear on Hovered Imagebutton Appear with Effect...?

#5 Post by ArizaLuca »

I think that only makes the button appear or disappear-- there is an image BEHIND that. (It's the part of the code on each Imagebutton that says

Code: Select all

[Show("gui_mainmenu", my_picture="images/mainmenu ri hover.png", my_tt_xpos=0, my_tt_ypos=0) ]
That's the part of the code that shows the image behind. That's what I would like to appear or disappear with an effect.

User avatar
Andredron
Miko-Class Veteran
Posts: 718
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: How to Make Things that Appear on Hovered Imagebutton Appear with Effect...?

#6 Post by Andredron »

:cry: .
ArizaLuca wrote: Sat Sep 15, 2018 8:00 am I think that only makes the button appear or disappear-- there is an image BEHIND that. (It's the part of the code on each Imagebutton that says

Code: Select all

[Show("gui_mainmenu", my_picture="images/mainmenu ri hover.png", my_tt_xpos=0, my_tt_ypos=0) ]
That's the part of the code that shows the image behind. That's what I would like to appear or disappear with an effect.
I have a PC in repair, try to finish

Code: Select all

imagebutton:
    auto "images/mainmenu_load_%s.png"
    xpos 0 ypos y 
    focus_mask True
    action ShowMenu('load')
    hovered [ Show("gui_mainmenu", my_picture="images/mainmenu ri_old_hover.png", my_tt_xpos=0, my_tt_ypos=0), With("dissolve") ] #With add
    unhovered [Hide("gui_mainmenu")] at main_eff2
[\code]

ArizaLuca
Veteran
Posts: 241
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen, Riddle Me This, Trust Fall, Phobias, Another Adventure
Projects: The Souls in the Seams, Fata Morgana, Minecraft: Story Mode - Behind the Scenes
Organization: Astral Autumn Games
Tumblr: astralautumngames
Deviantart: ArizaLuca
itch: astralautumngames
Contact:

Re: How to Make Things that Appear on Hovered Imagebutton Appear with Effect...?

#7 Post by ArizaLuca »

Code: Select all

 imagebutton:
        auto "images/mainmenu_start_%s.png" 
        xpos 0 ypos y 
        focus_mask True 
        action Start() 
        hovered [Show("gui_mainmenu", my_picture="images/mainmenu ri hover.png", my_tt_xpos=0, my_tt_ypos=0), With("dissolve") ] 
        unhovered [Hide("gui_mainmenu")] at main_eff1
I tried that, but what that ended up bringing up was the error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
TypeError: 'unicode' object is not callable

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/ast.py", line 862, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/python.py", line 1912, in py_exec_bytecode
    exec bytecode in 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 "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/ui.py", line 287, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/core.py", line 2649, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/core.py", line 2986, in interact_core
    new_widget=layers_root)
TypeError: 'unicode' object is not callable

Darwin-17.7.0-x86_64-i386-64bit
Ren'Py 7.0.0.196
Phantasmagoria Tests 1.0
Sat Sep 15 10:02:19 2018
(Thank you so much for helping me by the way, I'm such a noob at this xD)

Post Reply

Who is online

Users browsing this forum: No registered users