Ren'Py [SOLVED]Display the same screen more than once

Noldem

New Member
Aug 6, 2017
7
2
Alright so basically here's my code:
Code:
    for i in play_grid:
        renpy.show_screen(i.type, i.xbox, i.ybox)
        
screen gray_land(x,y):
    imagebutton:
        pos(x, y)
        idle "rpg/lands/gray_land.png"
i.type has always the value "gray_land"
xbox and ybox are just int which values differs

I'm trying to show a grid of the same screen plenty of times.
For now the grid is supposed to be 8x8.
It cannot be just images because they should be clickable.
I don't know if it is actually simple or if I have to do some crazy code to do this...
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,611
2,258
Why would you want multiple screens?

Why not something like:

Python:
    for i in play_grid:
        imagebutton:
            pos(i.xbox, i.ybox)
            auto "rpg/lands/{}_%s.png".format(i.type)

I'm sure your end code will be more complex than your example... but there's no reason why your screen can't contain multiple imagebuttons. I've also swapped your idle for , so the filename would end up being rpg/lands/gray_land_idle.png to be able to support hover images later.

... and that's before you start using screen elements like , or . Although I do dislike grid: as it forces the cells to be the same size in each direction.

If you are absolutely intent on multple screens within an overall screen, then there is .
 
Last edited:
  • Like
Reactions: LightmanP

Noldem

New Member
Aug 6, 2017
7
2
Ok I don't know why I didn't think about this solution with multiple image button inside the screen.
Thanks a lot!