Main Menu animations sticking through menus.

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
Aasta
Newbie
Posts: 7
Joined: Mon Jul 28, 2014 7:07 pm
Contact:

Main Menu animations sticking through menus.

#1 Post by Aasta » Wed Jul 30, 2014 7:03 pm

Basically the animations I have set up on the main menu on imagebutton hover don't hide when clicking on load/preferences (but does on starting the game).

Here is the relevant code...

Code: Select all

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    # The main menu buttons.
    vbox xalign .50 yalign .70:
        imagebutton auto "mm_buttons/fromthebeginning/button_%s.tga" focus_mask True action Start() hovered [ Show("bat_flap", my_xpos=250, my_ypos=293 ), Show("bat_flaps", my_xpos=550, my_ypos=293 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]
        imagebutton auto "mm_buttons/load/button_%s.tga" focus_mask True action ShowMenu('load') hovered [ Show("bat_flap", my_xpos=250, my_ypos=353 ), Show("bat_flaps", my_xpos=550, my_ypos=353 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]
        imagebutton auto "mm_buttons/options/button_%s.tga" focus_mask True action ShowMenu('preferences') hovered [ Show("bat_flap", my_xpos=250, my_ypos=408 ), Show("bat_flaps", my_xpos=550, my_ypos=408 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]

    vbox xalign .50 yalign .98:
        imagebutton auto "mm_buttons/gameover/button_%s.tga" focus_mask True action Quit(confirm=False) hovered [ Show("bat_flap", my_xpos=250, my_ypos=525 ), Show("bat_flaps", my_xpos=550, my_ypos=525 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]


init -2:

    # Make all the main menu buttons be the same size.
    style mm_button:
        size_group "mm"
    
    # Hover Animations
    image batani:
        "system/bat6.tga"
        pause 0.05
        "system/bat5.tga"
        pause 0.05
        "system/bat4.tga"
        pause 0.05
        "system/bat3.tga"
        pause 0.05
        "system/bat2.tga"
        pause 0.05
        "system/bat1.tga"
        pause 0.05
        "system/bat2.tga"
        pause 0.05
        "system/bat3.tga"
        pause 0.05
        "system/bat4.tga"
        pause 0.05
        "system/bat5.tga"
        pause 0.05
        "system/bat6.tga"
        pause 0.05
        "system/bat7.tga"
        pause 0.05
        repeat
When selecting the start game image button the bat_flap/bat_flaps hides, however with Load and Preferences the animations persist and don't hide as expected.

User avatar
Llunet1
Regular
Posts: 55
Joined: Mon Oct 21, 2013 8:56 pm
Projects: Reminiscence, Blood
Deviantart: llunet1
Location: USA
Contact:

Re: Main Menu animations sticking through menus.

#2 Post by Llunet1 » Fri Aug 08, 2014 1:09 pm

Huh. How interesting.
I don't see anything wrong with it... //though I'm a beginner with imagebutton code ^^;

Though, I don't see the coordinates for your buttons. Normally there's an xpos and ypos within the line of code. I don't think that's the problem, but try it out?

Sorry, I'm of little use, aren't I? ^^; Hopefully you'll find someone who knows this code better than I do...

User avatar
PyTom
Ren'Py Creator
Posts: 15444
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: Main Menu animations sticking through menus.

#3 Post by PyTom » Fri Aug 08, 2014 7:59 pm

First off, .tga is not a good format by today's standards. Use .png or .jpg.

Secondly... what are bat_flap and bat_flaps?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Aasta
Newbie
Posts: 7
Joined: Mon Jul 28, 2014 7:07 pm
Contact:

Re: Main Menu animations sticking through menus.

#4 Post by Aasta » Sat Aug 09, 2014 4:59 am

The bat_flap and bat_flaps was an animation I had on the main menu (bat_flaps being simply a duplicate of bat_flap) for showing when the imagebuttons were hovered. The issue seemed that clicking the load or preference menus would leave the animations shown as the engine never saw the buttons "unhovered" thus never removed them... I did find a way to make it work today by changing it to something like this...

Code: Select all

    # The main menu buttons.
    vbox xalign .50 yalign .70:
        imagebutton auto "mm_buttons/fromthebeginning/button_%s.tga" focus_mask True action Start() hovered [ Show("bat_flap", my_xpos=250, my_ypos=293 ), Show("bat_flaps", my_xpos=550, my_ypos=293 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]
        imagebutton auto "mm_buttons/load/button_%s.tga" focus_mask True action [Hide("bat_flap"), Hide("bat_flaps"), ShowMenu('load')] hovered [ Show("bat_flap", my_xpos=250, my_ypos=353 ), Show("bat_flaps", my_xpos=550, my_ypos=353 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]
        imagebutton auto "mm_buttons/options/button_%s.tga" focus_mask True action [Hide("bat_flap"), Hide("bat_flaps"), ShowMenu('preferences')] hovered [ Show("bat_flap", my_xpos=250, my_ypos=408 ), Show("bat_flaps", my_xpos=550, my_ypos=408 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]

    vbox xalign .50 yalign .98:
        imagebutton auto "mm_buttons/gameover/button_%s.tga" focus_mask True action Quit(confirm=False) hovered [ Show("bat_flap", my_xpos=250, my_ypos=525 ), Show("bat_flaps", my_xpos=550, my_ypos=525 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]

Basically I just had to add the hide into the action command, which I had tried before but had put the hide command after the ShowMenu commands... which did not work I assume due to the engine processing the commands in order. Problem was solved when I moved the Hide commands to the front of the action command brackets.


As for my usage of TGAs... Normally I prefer PNG file formats but due to some restrictions, TGA is what I am using for now.

Edit: I seem to have missed adding the actual bat_flap portion in my original post... so I'll add this as reference...

Code: Select all

screen bat_flap:
    add "batani" xpos my_xpos ypos my_ypos

screen bat_flaps:
    add "batani" xpos my_xpos ypos my_ypos



##############################################################################
# Main Menu
#
# Screen that's used to display the main menu, when Ren'Py first starts
# http://www.renpy.org/doc/html/screen_special.html#main-menu

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    # The main menu buttons.
    vbox xalign .50 yalign .70:
        imagebutton auto "mm_buttons/fromthebeginning/button_%s.tga" focus_mask True action Start() hovered [ Show("bat_flap", my_xpos=250, my_ypos=293 ), Show("bat_flaps", my_xpos=550, my_ypos=293 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]
        imagebutton auto "mm_buttons/load/button_%s.tga" focus_mask True action [Hide("bat_flap"), Hide("bat_flaps"), ShowMenu('load')] hovered [ Show("bat_flap", my_xpos=250, my_ypos=353 ), Show("bat_flaps", my_xpos=550, my_ypos=353 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]
        imagebutton auto "mm_buttons/options/button_%s.tga" focus_mask True action [Hide("bat_flap"), Hide("bat_flaps"), ShowMenu('preferences')] hovered [ Show("bat_flap", my_xpos=250, my_ypos=408 ), Show("bat_flaps", my_xpos=550, my_ypos=408 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]

    vbox xalign .50 yalign .98:
        imagebutton auto "mm_buttons/gameover/button_%s.tga" focus_mask True action Quit(confirm=False) hovered [ Show("bat_flap", my_xpos=250, my_ypos=525 ), Show("bat_flaps", my_xpos=550, my_ypos=525 ) ] unhovered [ Hide("bat_flap"), Hide("bat_flaps") ]



init -2:

    # Make all the main menu buttons be the same size.
    style mm_button:
        size_group "mm"
    
    # Hover Animations
    image batani:
        "system/bat6.tga"
        pause 0.05
        "system/bat5.tga"
        pause 0.05
        "system/bat4.tga"
        pause 0.05
        "system/bat3.tga"
        pause 0.05
        "system/bat2.tga"
        pause 0.05
        "system/bat1.tga"
        pause 0.05
        "system/bat2.tga"
        pause 0.05
        "system/bat3.tga"
        pause 0.05
        "system/bat4.tga"
        pause 0.05
        "system/bat5.tga"
        pause 0.05
        "system/bat6.tga"
        pause 0.05
        "system/bat7.tga"
        pause 0.05
        repeat

User avatar
PyTom
Ren'Py Creator
Posts: 15444
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: Main Menu animations sticking through menus.

#5 Post by PyTom » Sat Aug 09, 2014 10:51 pm

Offhand - why are you showing the bat_ screens with Show and Hide, rather than using them from your various other screens.

Also, what's the reason for not using PNGs? I can't think of any reason why TGAs would be superior.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Aasta
Newbie
Posts: 7
Joined: Mon Jul 28, 2014 7:07 pm
Contact:

Re: Main Menu animations sticking through menus.

#6 Post by Aasta » Sun Aug 10, 2014 9:11 pm

PyTom wrote:Offhand - why are you showing the bat_ screens with Show and Hide, rather than using them from your various other screens.
Not sure I understand the question, but if I understand correctly you are asking why I don't just show the screens as is and use a show/hide command? The answer is that I needed them to show up when the imagebuttons were hovered but hidden any other time. Similar to showing a tooltip when you hover over something.
PyTom wrote:Also, what's the reason for not using PNGs? I can't think of any reason why TGAs would be superior.
Some of the early-made art was done in TGA and I no longer have any non-tga/higher quality formats of the files. Technically I could just convert them to PNGs now but the original art files are still TGA. I figured there wouldn't really be much reason to convert the TGAs to PNG when the base is TGA only anyways.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]