[Error] Gallery always locked
Posted: Fri Feb 19, 2016 9:22 pm
Tried to use the gallery that is on the rooms page of the wiki on renpy.org, and it shows, but when it should unlock the scene related to it it doesn't unlock anything. I don't know if I'm doing it wrong, or if I'm really noob with this...
Code: Select all
init python:
# Step 1. Create the gallery object.
g = Gallery()
# Step 2. Add buttons and images to the gallery.
# A button that contains an image that automatically unlocks.
g.button("escena1")
g.condition("persistent.unlock_1")
g.unlock("cg/momento_divertido.png")
# This button has multiple images assocated with it. We use unlock_image
# so we don't have to call both .image and .unlock. We also apply a
# transform to the first image.
g.button("escena2")
g.unlock_image("momento")
# This button has a condition associated with it, allowing code
# to choose which images unlock.
g.button("escena3")
g.unlock_image("escena3")
g.button("escena4")
g.unlock_image("escena4")
# The last image in this button has an condition associated with it,
# so it will only unlock if the user gets both endings.
g.button("final1")
g.unlock_image("final2")
g.button("final2")
g.unlock_image("final2")
# The final two buttons contain images that show multiple pictures
# at the same time. This can be used to compose character art onto
# a background.
g.button("final3")
g.unlock_image("final3")
g.button("final4")
g.unlock_image("final4")
# The transition used when switching images.
g.transition = dissolve
# Step 3. The gallery screen we use.
screen gallery:
# Ensure this replaces the main menu.
tag menu
# The background.
add "sys/fondo.png"
# A grid of buttons.
grid 3 3:
xfill True
yfill True
# Call make_button to show a particular button.
add g.make_button("escena1", "sys/gallocked.png", xalign=0.5, yalign=0.5)
add g.make_button("escena2", "sys/gallocked.png", xalign=0.5, yalign=0.5)
add g.make_button("escena3", "sys/gallocked.png", xalign=0.5, yalign=0.5)
add g.make_button("escena4", "sys/gallocked.png", xalign=0.5, yalign=0.5)
add g.make_button("final1", "sys/gallocked.png", xalign=0.5, yalign=0.5)
add g.make_button("final2", "sys/gallocked.png", xalign=0.5, yalign=0.5)
add g.make_button("final3", "sys/gallocked.png", xalign=0.5, yalign=0.5)
add g.make_button("final4", "sys/gallocked.png", xalign=0.5, yalign=0.5)
# The screen is responsible for returning to the main menu. It could also
# navigate to other gallery screens.
textbutton "Return" action Return() xalign 0.5 yalign 0.5