Moving an ImageButton to the foreground

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
rjrhodeswrites
Newbie
Posts: 2
Joined: Mon Oct 24, 2022 10:33 am
itch: rjrhodeswrites
Contact:

Moving an ImageButton to the foreground

#1 Post by rjrhodeswrites » Mon Oct 24, 2022 10:46 am

Hi everybody. I'm working on a UI that shows a bunch of polaroids on the screen - they're placed semi randomly, and will occasionally overlap a bit. When you hover over one, it zooms in larger, which causes it to overlap the others around it even more.

My problem is since the depth is defined by the order the buttons are placed, the one you want to click is sometimes displayed behind the other buttons.

Image

I'd like to make this to where when you hover over the imagebutton (such as the one that is pink here), it zooms in and moves to the front of the stack. Currently my code looks like this:

Code: Select all

transform izzytilted():
    on idle: 
        rotate izzytilt
        easeout 0.2 zoom 1.0
    on hover: 
        rotate izzytilt
        easein 0.5 zoom 1.3

Then I just apply the transform to the imagebutton when posted. I was hoping that I could just do something like zpos here, but I could not get that to work, and after researching, I think maybe perspective doesn't work on Imagebuttons?

I'm a little stumped at this point. Any suggestions welcome! Thank you!

rjrhodeswrites
Newbie
Posts: 2
Joined: Mon Oct 24, 2022 10:33 am
itch: rjrhodeswrites
Contact:

Re: Moving an ImageButton to the foreground

#2 Post by rjrhodeswrites » Mon Oct 24, 2022 11:55 am

I just figured this out.

I made it to where when hovered on, it would ShowTransient a screen that contained the same imagebutton.

A bit of a workaround, but it seems to be working right!

Would still be open to any other suggestions that might be cleaner.

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1882
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Moving an ImageButton to the foreground

#3 Post by Ocelot » Mon Oct 24, 2022 12:33 pm

Yeah that works. Other way is to store all button data in a list and on hover bring button data to the front of the lis and redraw screen.

Also you could use 3D stage and literally move button closer to the camera.
< < insert Rick Cook quote here > >

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]