My visual novel will have a protagonist with different looks: red hair and black hair (there are other combinations, but for simplicity, let's just leave these).
My visual novel also has an image gallery.
I want the unlocked image to be of the hair chosen by the player. However, because they are two identical images (only with changed hair color) I want only one to exist in the game and go to the gallery.
I'll explain it better by code:
Code: Select all
if blackhair == True:
image cg1 = "cg1black.jpg"
else:
image cg1 = "cg1red.jpg"
This is my gallery code:
Code: Select all
init python:
def MaxScale(img, minwidth=config.screen_width, minheight=config.screen_height):
currwidth, currheight = renpy.image_size(img)
xscale = float(minwidth) / currwidth
yscale = float(minheight) / currheight
if xscale > yscale:
maxscale = xscale
else:
maxscale = yscale
return im.FactorScale(img, maxscale, maxscale)
def MinScale(img, maxwidth=config.screen_width, maxheight=config.screen_height):
currwidth, currheight = renpy.image_size(img)
xscale = float(maxwidth) / currwidth
yscale = float(maxheight) / currheight
if xscale < yscale:
minscale = xscale
else:
minscale = yscale
return im.FactorScale(img, minscale, minscale)
maxnumx = 2
maxnumy = 2
maxthumbx = config.screen_width / (maxnumx + 1)
maxthumby = config.screen_height / (maxnumy + 1)
maxperpage = maxnumx * maxnumy
gallery_page = 0
closeup_page = 0
class GalleryItem:
def __init__(self, name, images, thumb, locked="lock"):
self.name = name
self.images = images
self.thumb = thumb
self.locked = locked
self.refresh_lock()
def num_images(self):
return len(self.images)
def refresh_lock(self):
self.num_unlocked = 0
lockme = False
for img in self.images:
if not renpy.seen_image(img):
lockme = True
else:
self.num_unlocked += 1
self.is_locked = lockme
gallery_items = []
gallery_items.append(GalleryItem("Image 1", ["cg1"], "thumb1"))
I hope you understand, I hope it is possible and thank you for your help!