Here's my gallery code:
Code: Select all
init python:
# Step 1. Create the gallery object.
g = Gallery()
g.locked_button = "images/gallery/locked.png" #this is the thumbnail image for ALL LOCKED gallery previews, found in the images folder
# Step 2. Add buttons and images to the gallery.
# A button that contains an image that automatically unlocks.
g.button("g_01")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_01.png")
g.button("g_02")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_02.png")
g.button("g_03")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_03.png")
g.button("g_04")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_04.png")
g.button("g_05")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_05.png")
g.button("g_06")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_06.png")
g.button("g_07")
g.condition("persistent.unlock_2")
g.image("images/gallery/g_07.png")
g.button("g_08")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_08.png")
g.button("g_09")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_09.png")
g.button("g_10")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_10.png")
g.button("g_11")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_11.png")
g.button("g_12")
g.condition("persistent.unlock_1")
g.image("images/gallery/g_12.png")
g.transition = Dissolve(0.2)
screen image_gallery:
# Ensure this replaces the main menu.
tag menu
# The background.
add "images/gallery/bg.png"
# A grid of buttons.
grid 4 3:
xfill True
yfill True
# Call make_button to show a particular button.
add g.make_button("g_01", "images/gallery/1.png", xalign=0.5, yalign=0.5)
add g.make_button("g_02", "images/gallery/2.png", xalign=0.5, yalign=0.5)
add g.make_button("g_03", "images/gallery/3.png", xalign=0.5, yalign=0.5)
add g.make_button("g_04", "images/gallery/4.png", xalign=0.5, yalign=0.5)
add g.make_button("g_05", "images/gallery/5.png", xalign=0.5, yalign=0.5)
add g.make_button("g_06", "images/gallery/6.png", xalign=0.5, yalign=0.5)
add g.make_button("g_07", "images/gallery/7.png", xalign=0.5, yalign=0.5)
add g.make_button("g_08", "images/gallery/8.png", xalign=0.5, yalign=0.5)
add g.make_button("g_09", "images/gallery/9.png", xalign=0.5, yalign=0.5)
add g.make_button("g_10", "images/gallery/10.png", xalign=0.5, yalign=0.5)
add g.make_button("g_11", "images/gallery/11.png", xalign=0.5, yalign=0.5)
add g.make_button("g_12", "images/gallery/12.png", xalign=0.5, yalign=0.5)
imagemap:
idle "gui/d_profile_idle.png"
hover "gui/d_profile_hover.png"
hotspot (881, 982, 191, 52) action Return():
hover_sound "audio/hoversound.mp3"
activate_sound "audio/choicesound.mp3"