I'm having an issue with my gallery...First time I've tried to code a game, so would appreciate any advice.
Here's a screenshot:
https://imgur.com/n1FMXpL (sorry, can't embed it for some reason...I'm really useless...)
These images are only there as placeholders until my CGs are ready, so this won't be the final gallery, but I'm trying to get the framework right.
My main issues are:
1. The thumbnails are, obviously, on top of each other and I don't know how to fix it
2. I don't know how to put 'unlock' code on them so they'll unlock after being seen in-game
3. I don't know how to make the 'hover_border' code work
Could anyone please identify where I'm going wrong?
Code: Select all
label gallery:
scene bg beach
init:
image bg airport = 'airport.jpg'
image black = '#000'
image beared = 'beared.png'
image forest day = 'forest day.jpg'
image bg plane = 'plane.jpg'
image title = 'title.png'
image bg forest = 'jungle.jpg'
image camp forest = 'camp forest.jpg'
image bg beach = 'beach.jpg'
image bg hotel = 'hotel day.jpg'
image hotel room = 'hotel room.jpg'
image shrine = 'shrine.jpg'
image bg hotel night = 'hotel night.jpg'
image bear = 'bear.jpg'
image beachforest = 'beachforest.jpg'
image water = 'salvage.jpg'
image fresh = 'fresh water.jpg'
image bg camp = 'camp.jpg'
image bg fire = 'fire.jpg'
image sethCG1 = 'sethCG1.jpg'
init python:
#Galleries settings - start
#list the CG gallery images here:
gallery_cg_items = ["bg airport", "bg plane", "bg camp", "bg fire", "sethCG1", "bear", "shrine", "fresh", "hotel room", "bg beach"]
#how many rows and columns in the gallery screens?
gal_rows = 3
gal_cols = 3
#thumbnail size in pixels:
thumbnail_x = 267
thumbnail_y = 150
#the setting above (267x150) will work well with 16:9 screen ratio. Make sure to adjust it, if your are using 4:3 or something else.
#Galleries settings - end
g_cg = Gallery()
g_cg.transition = dissolve
gal_cells = gal_rows * gal_cols
for gal_item in gallery_cg_items:
g_cg.hover_border = "gallery_hover.png"
g_cg.button(gal_item + " butt")
g_cg.image(gal_item)
g_cg.unlock(gal_item)
g_cg.transition = fade
cg_page=0
init +1 python:
#Here we create the thumbnails. We create a grayscale thumbnail image for BGs, but we use a special "locked" image for CGs to prevent spoilers.
for gal_item in gallery_cg_items:
renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), thumbnail_x, thumbnail_y))
screen gallery:
tag menu
add "bg beach"
use navigation
frame background None xpos 10:
grid gal_rows gal_cols:
ypos 10
xpos 10
$ i = 0
$ next_cg_page = cg_page + 1
if next_cg_page > int(len(gallery_cg_items)/gal_cells):
$ next_cg_page = 0
for gal_item in gallery_cg_items:
$ i += 1
if i <= (cg_page+1)*gal_cells and i>cg_page*gal_cells:
add g_cg.make_button(gal_item + " butt", gal_item + " butt", im.Scale("gallocked.png", thumbnail_x, thumbnail_y), xalign=0.5, yalign=0.5, idle_border=None, background=None, bottom_margin=24)
for j in range(i, (cg_page+1)*gal_cells): #we need this to fully fill the grid
null
frame:
yalign 0.97
vbox:
if len(gallery_cg_items)>gal_cells:
textbutton _("Next Page") action [SetVariable('cg_page', next_cg_page), ShowMenu("gallery")]
show gallery()