So now that I'm working on my second one for this year's NaNoRenO, I can't make this code work again... There's no problem on the script or code since no "traceback" text is appearing but I have this problem:
As you can see, the boxes are not in line and they're on top of each other, overlapping. The first CG and the fourth CG overlaps, and that's what happen if there's more 5th and 6th CGs. I only have 5 CGs to show for the game in total but I used this 4 CGs to test the code again. When the reader sees the CG on the gameplay, the code automatically unlocks the photo, so I have no problem with getting it unlocked... But the problems I have are:
1. The photos are overlapping each other and
2. When I click the unlocked CG photos to view them full screen, it doesn't happpen (because on my previous VN, you can view them by full screen when you unlock the CG)
3. Background is transparent.
Here's the code that I have as of now:
Code: Select all
init python:
#Galleries settings - start
#list the CG gallery images here:
gallery_cg_items = ["Dead 1", "Dead 2", "Dead 3", "Prisoner 1"]
#how many rows and columns in the gallery screens?
gal_rows = 3
gal_cols = 3
#thumbnail size in pixels:
thumbnail_x = 450
thumbnail_y = 300
#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
gal_cells = gal_rows * gal_cols
g_cg = Gallery()
for gal_item in gallery_cg_items:
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 cg_gallery:
tag menu
use navigation
frame background None xpos 10:
grid gal_rows gal_cols:
ypos 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("cg_gallery")]
NaNoRenO is almost done, and I'm not sure whether I can make a CG gallery for it. It's my first participation on NaNoRenO and everything feels like rushed, so I'm rushing the code, too. If I couldn't make the code work for this NaNoRenO, I then hope that my problem gets solved even after NaNoRenO cos leon's code is just amazing and easier to understand than any other code/tutorial I've searched, I want to keep using this code. I owe my life to it. Jk. But I really like the code a lot.