Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hello! May I ask what the easiest way to make multiple pages for the gallery is? My apologies if it's obvious, I'm just very new to Renpy. I got my cgs showing up, but cant figure out how to get more pages that display separate images.

(+1)

No worries! If you're using the basic screen provided in the template, then the simplest is to add a "page" variable in the screen, and use that to adjust which images are displayed. I recommend just manually adding the buttons, unless you're familiar with `for` loops already! So, a very basic version might be:

screen gallery():
    tag menu
    default page = 1
    add HBox(Transform("#292835", xsize=350), "#21212db2") # The background; can be whatever
    use game_menu(_("Gallery"))
    fixed:
        style_prefix 'gal'
        ## Organize the gallery images into a grid
        grid 2 2:
            if page == 1:
                add g.make_button("xia_cg_1", "xia_cg_1_thumb")
                add g.make_button("xia_cg_2", "xia_cg_2_thumb")
                add g.make_button("xia_cg_3", "xia_cg_3_thumb")
                add g.make_button("xia_cg_4", "xia_cg_4_thumb")
            elif page == 2:
                add g.make_button("zoran_cg_1", "zoran_cg_1_thumb")
                add g.make_button("zoran_cg_2", "zoran_cg_2_thumb")
                add g.make_button("zoran_cg_3", "zoran_cg_3_thumb")
                add g.make_button("zoran_cg_4", "zoran_cg_4_thumb")
            # add more elif page == 3 and so on if you have more
    
    hbox:         yalign 1.0         ## Either directly set the page, e.g.         textbutton _("Page 1") action SetScreenVariable("page", 1)         ## Or have buttons to go to the next/prev page e.g.         if page < 2: # We have 2 pages total             textbutton _("Next") action SetScreenVariable("page", page+1)         if page > 1: # Make sure it doesn't go below 1             textbutton _("Next") action SetScreenVariable("page", page-1)


Hope that helps!