I'm trying to use image gallery following this tutorial but I need help on some things.
The code doesn't give me any erros, but I don't know how I can unlock a image to see it on the gallery. I used both gallery.unlock and gallery.unlock_image but neither helped me.
I read that a image is unlocked after the player sees it, so I added the images on the game via character and background but even after I see them I can't unlock them on the gallery.
The following code is on script.rpy.
Code: Select all
# Declare images below this line, using the image statement.
image bg01_00 = "image/gallery/1-0.png"
image bg01_01 = "image/gallery/1-1.png"
image teste 01 = "image/gallery/1-1.png"
# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8")
init python:
# Step 1. Create the gallery object.
g = Gallery()
# The transition used when switching images.
g.transition = dissolve
# An image used as the background of the various gallery pages.
g.background = "image/gallery/gallery_background.jpg"
# The image used for locked buttons.
g.locked_button = "image/gallery/gallerybutton_locked.png"
# The background of a locked image.
g.locked_background = "image/gallery/gallery_background.jpg"
# Step 2. Add buttons and images to the gallery.
# A button that contains an image that automatically unlocks.
g.button("1-0")
g.image("image/gallery/1-1.png")
g.unlock("image/gallery/1-1.png")
# This button has multiple images assocated with it.
# We use unlock_image so we don't have to call both .image and .unlock.
g.button("2-0")
g.unlock_image("image/gallery/2-1.png")
g.button("3-0")
g.unlock_image("image/gallery/3-1.png", "image/gallery/3-2.png")
g.button("4-0")
g.unlock_image("image/gallery/4-1.png", "image/gallery/4-2.png")
g.button("5-0")
g.unlock_image("image/gallery/5-1.png", "image/gallery/5-2.png")
# Step 3. The gallery screen we use.
screen gallery:
# Ensure this replaces the main menu.
tag menu
# The background.
add "image/gallery/gallery_background.jpg"
# A grid of buttons.
grid 3 3:
xfill True
yfill True
# Call make_button to show a particular button.
add g.make_button("1-0", "image/gallery/1-0.png", xalign=0.5, yalign=0.5)
add g.make_button("1-0", "image/gallery/1-1.png", xalign=0.5, yalign=0.5)
add g.make_button("2-0", "image/gallery/2-0.png", xalign=0.5, yalign=0.5)
add g.make_button("3-0", "image/gallery/3-0.png", xalign=0.5, yalign=0.5)
add g.make_button("4-0", "image/gallery/4-0.png", xalign=0.5, yalign=0.5)
add g.make_button("5-0", "image/gallery/5-0.png", xalign=0.5, yalign=0.5)
null
null
# 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
# The game starts here.
label start:
scene bg01_00
show teste 01 at left
e "You've created a new Ren'Py game."
scene bg01_01
e "Once you add a story, pictures, and music, you can release it to the world!"
return
Code: Select all
textbutton "Gallery" action ShowMenu("gallery")