Ren'Py Ren'Py Gallery

Deleted member 416612

The 'landlord'
Donor
Game Developer
Feb 2, 2018
924
3,920
Hello, forum,

Can anyone help me with how can I create a gallery ( from which the player will unlock scenes as there is progress in-game).


I've found this code and also I've created a different Ren'py file to place it.

init:
# Position the navigation on the right side of the screen.
$ style.gallery_nav_frame.xpos = 800 - 10
$ style.gallery_nav_frame.xanchor = 1.0
$ style.gallery_nav_frame.ypos = 12

# Add the gallery to the main menu.
$ config.main_menu.insert(2, ('Gallery', "gallery", "True"))

# The entry point to the gallery code.
label gallery:
python hide:

# Construct a new gallery object.
g = Gallery()

# The image used for locked buttons.
g.locked_button = "gallery_locked.png"

# The background of a locked image.
g.locked_background = "gallery_lockedbg.jpg"

# Frames added over unlocked buttons, in hover and idle states.
g.hover_border = "gallery_hover.png"
g.idle_border = "gallery_idle.png"

# An images used as the background of the various gallery pages.
g.background = "gallery_background.jpg"

# Lay out the gallery images on the screen.
# These settings lay images out 3 across and 4 down.
# The upper left corner of the gird is at xpos 10, ypos 20.
# They expect button images to be 155x112 in size.
g.grid_layout((3, 4), (10, 12), (160, 124))

# Show the background page.
g.page("Backgrounds")

# Our first button is a picture of the beach.
g.button("thumb_beach.jpg")
#
# These show images, if they have been unlocked. The image name must
# have been defined using an image statement.
g.unlock_image("bg beach daytime")
g.unlock_image("bg beach nighttime")
#
# This shows a displayable...
g.display("beach_sketch.jpg")
# ... if all prior images have been show.
g.allprior()

# A second set of images.
g.button("thumb_lighthouse.jpg")
g.unlock_image("bg lighthouse day")
g.unlock_image("bg lighthouse night")
g.display("lighthouse_sketch.jpg")
g.allprior()



# We can use g.page to introduce a second page.
g.page("Characters")

g.button("thumb_eileen.jpg")
#
# Note that we can give image and unlock image more than one image
# at a time.
g.unlock_image("bg lighthouse day", "eileen day happy")
g.unlock_image("bg lighthouse day", "eileen day mad")



# Another page, this one for concept art.
g.page("Concept Art")

g.button("thumb_concepts.jpg")
#
# We can apply conditions to buttons as well as to images.
# The "condition" condition checks an arbitrary expression.
g.condition("persistent.beat_game")
#
g.display("concept1.jpg")
g.display("concept2.jpg")
g.display("concept3.jpg")


# Now, show the gallery.
g.show()

jump main_menu_screen

Can anyone help?

Thank you
 

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,058
I don't know the ins and the outs of the function but that gallery code is out of date. has the more recent documentation with an example and a break down.

For my current project I did a in-game scene gallery instead of just an image gallery.
 
Last edited:

Deleted member 416612

The 'landlord'
Donor
Game Developer
Feb 2, 2018
924
3,920
I don't know the ins and the outs of the function but that gallery code is out of date. has the more recent documentation with an example and a break down.

For my current project, I did an in-game scene gallery instead of just an image gallery.
Thanks, mate for the feedback! When do you say in-game gallery you meant in the in-game UI and not the main menu or something else?
 

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,058
Basically I have a UI to interact with characters in my game, and from that menu there is a "Memories" option. The memories option has the sex scenes you have experienced with that character.
When you pass over a scene in a playthrough I call a function that adds a string that is the name of the label for that scene to a list associated to the character, I only add the string if that string is not in the list.
Python:
    def relationshipfunction_AddHSceneToMemories(char,point):
        if char.characterstat_LabelsOfSexScenesForMemories[0] == 'none':
            char.characterstat_LabelsOfSexScenesForMemories[0] = point
        else:
            if point not in char.characterstat_LabelsOfSexScenesForMemories:
                char.characterstat_LabelsOfSexScenesForMemories.append(point)
The more relevant part of the character interaction code:
Python:
if uidisplay_WhichTabOnCharacterInteractionIsVisible == "Memories":
                    vpgrid:
                        xalign 1.0
                        xsize 1440
                        xfill True
                        cols 5
                        rows 6
                        draggable True
                        mousewheel True
                        scrollbars "vertical"
                        $ empty = 30
                        if relationshipsystem_CurrentCharacterForInteraction.characterstat_TypeOfCharacter != "Generated":
                            if relationshipsystem_CurrentCharacterForInteraction.characterstat_LabelsOfSexScenesForMemories[0] != "none" :
                                for jumps in relationshipsystem_CurrentCharacterForInteraction.characterstat_LabelsOfSexScenesForMemories:
                                    imagebutton idle "characters/%s/thumbnails/%s.webp" % (truechar.name,jumps) hover "characters/%s/thumbnails/%s.webp" % (truechar.name,jumps) action Replay(jumps) padding (5,5,5,5)
                                    $ empty -=1
                        else:
                            ##### VERY SPECIFIC NON-RELEVANT CODE####
                        for x in range(0,empty):
                            imagebutton idle "empty" action NullAction() padding (5,5,5,5)
This screen is currently only accessible from your currently loaded game.

NSFW Shot of the Scene-gallery:
scene-gallery.jpg
 

Deleted member 416612

The 'landlord'
Donor
Game Developer
Feb 2, 2018
924
3,920
Basically I have a UI to interact with characters in my game, and from that menu there is a "Memories" option. The memories option has the sex scenes you have experienced with that character.
When you pass over a scene in a playthrough I call a function that adds a string that is the name of the label for that scene to a list associated to the character, I only add the string if that string is not in the list.
Python:
    def relationshipfunction_AddHSceneToMemories(char,point):
        if char.characterstat_LabelsOfSexScenesForMemories[0] == 'none':
            char.characterstat_LabelsOfSexScenesForMemories[0] = point
        else:
            if point not in char.characterstat_LabelsOfSexScenesForMemories:
                char.characterstat_LabelsOfSexScenesForMemories.append(point)
The more relevant part of the character interaction code:
Python:
if uidisplay_WhichTabOnCharacterInteractionIsVisible == "Memories":
                    vpgrid:
                        xalign 1.0
                        xsize 1440
                        xfill True
                        cols 5
                        rows 6
                        draggable True
                        mousewheel True
                        scrollbars "vertical"
                        $ empty = 30
                        if relationshipsystem_CurrentCharacterForInteraction.characterstat_TypeOfCharacter != "Generated":
                            if relationshipsystem_CurrentCharacterForInteraction.characterstat_LabelsOfSexScenesForMemories[0] != "none" :
                                for jumps in relationshipsystem_CurrentCharacterForInteraction.characterstat_LabelsOfSexScenesForMemories:
                                    imagebutton idle "characters/%s/thumbnails/%s.webp" % (truechar.name,jumps) hover "characters/%s/thumbnails/%s.webp" % (truechar.name,jumps) action Replay(jumps) padding (5,5,5,5)
                                    $ empty -=1
                        else:
                            ##### VERY SPECIFIC NON-RELEVANT CODE####
                        for x in range(0,empty):
                            imagebutton idle "empty" action NullAction() padding (5,5,5,5)
This screen is currently only accessible from your currently loaded game.

NSFW Shot of the Scene-gallery:
View attachment 183752

Thank you mate!