- Aug 13, 2019
- 1,898
- 2,923
So I'm making a gallery. The gallery will show the thumbs as imagebuttons. I want the image button to show a different screen, but these image buttons won't exactly show me the screen I want to.
How the hell do I fix this?
Python:
init python:
class Gallery:
def __init__(self, name, images, thumb, character, locked="gallery_locked"):
self.name = name
self.images = images
self.thumb = thumb
self.character = [0,1,2,3,4]
self.locked = locked
self.refresh_lock()
self.charactername()
def num_images(self):
return len(self.images)
def refresh_lock(self):
self.num_unlock = 0
lockme = False
for img in self.images:
if not renpy.seen_image(img):
lockme = True
else:
self.num_unlock += 1
self.is_locked = lockme
def charactername(self):
return self.character[0]
gallery_images = []
gallery_images.append(Gallery("Charlotte", ["charlotte1"], "thumbcharlotte1", 0))
gallery_images.append(Gallery("Julia", ["julia1"], "thumbjulia1", 1))
gallery_images.append(Gallery("Valerie", ["valerie1"], "thumbvalerie1", 2))
gallery_images.append(Gallery("Laura", ["laura1"], "thumblaura1", 3))
gallery_images.append(Gallery("Eileen", ["eileen1"], "thumbeileen1", 4))
gallery_images.append(Gallery("Harem", ["harem1"], "thumbharem1", 5))
screen gallery:
tag menu
add "black"
$ start = gallery_page * maxperpage
$ end = min(start + maxperpage - 1, len(gallery_images) - 1)
#image grid
grid maxnumx maxnumy:
xfill True
yfill True
for i in range(start, end + 1):
$ gallery_images[i].refresh_lock()
if gallery_images[i].is_locked:
null
else:
imagebutton idle gallery_images[i].thumb:
if gallery_images[i].character[0]:
action Show("gallerychar_charlotte", dissolve,)
elif gallery_images[i].character[1]:
action Show("gallerychar_julia", dissolve,)
elif gallery_images[i].character[2]:
action Show("gallerychar_valerie", dissolve,)
elif gallery_images[i].character[3]:
action Show("gallerychar_laura", dissolve,)
elif gallery_images[i].character[4]:
action Show("gallerychar_eileen", dissolve,)
elif gallery_images[i].character[5]:
action Show("gallerychar_harem", dissolve,)
xalign 0.5
yalign 0.5
for i in range(end - start + 1, maxperpage):
null
#names
grid maxnumx maxnumy:
xfill True
yfill True
for i in range(start, end + 1):
hbox:
spacing maxthumby - 70
xalign 0.5
yalign 0.9
$ total = gallery_images[i].num_images()
$ partial = gallery_images[i].num_unlock
if gallery_images[i].is_locked:
null
else:
text gallery_images[i].name
text "[partial]/[total]"
for i in range(end - start + 1, maxperpage):
null
#previous and next buttons
if gallery_page > 0:
textbutton "<":
action SetVariable("gallery_page", gallery_page - 1)
xalign 0.1
yalign 1.0
if (gallery_page + 1) * maxperpage < len(gallery_images):
textbutton ">":
action SetVariable("gallery_page", gallery_page + 1)
xalign 0.9
yalign 1.0
#return button
textbutton "Return":
action Return()
xalign 1.0
yalign 0.01