How to add a CG Gallery?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
yuiriko
Newbie
Posts: 10
Joined: Mon Sep 05, 2011 12:00 pm
Projects: Softunyaa
Organization: Gienia Gurupu
Location: Poland
Contact:

How to add a CG Gallery?

#1 Post by yuiriko » Mon Sep 05, 2011 1:37 pm

I need an easy tutorial how to add a CG Gallery.

I'm a noob at Ren'Py, I don't even know how to add a gallery button to the main menu -.-
Wiki instructions are too hard for me :( Can anyone help me, making it more simple?

I've created the new_gallery.rpy file and add all the needed text form http://www.renpy.org/wiki/renpy/doc/cookbook/CG_Gallery, but it still won't work.

Thanks

User avatar
Soraminako
Veteran
Posts: 277
Joined: Sun Sep 04, 2011 1:36 am
Projects: A thingie without a title. With messy code.
Contact:

Re: How to add a CG Gallery?

#2 Post by Soraminako » Mon Sep 05, 2011 5:34 pm

Sorry to jump into your thread, but I'm a total noob as well and am hoping someone answers this thread, as I have almost the same problem as you.

The instructions and documentation are probably wonderful and helpful for the advanced users, but all I can get out of it is a deep sense of personal failure and frustration.
I read it over and over and I either never understand or what I do manage to try using almost never works. It's just so saddening. I stare at the open little renpy window the way I remember staring at difficult and unpleasant homework when I was a little kid.

I can only hope one day this will change, but so far it's been a while trying to learn it and I still can't even use the wiki for help so it's complete luck when things actually work for me. :(
Mostly my game attempt is just made of code learned from the example VNs and from the threads here in the forum, as I can't use the wiki for anything. Maybe it's because the wiki doesn't have images, so even when something seems simple in theory I don't get what would be what and what should look like what.

In any case, I managed to get a gallery button to show up in my menu, but that's it. I have no idea how to make the gallery work, and it's all very chaotic the way I have it now. :(

Maybe my code can help you with the button part, but I'm stuck with the rest.

I put the new_gallery.rpy file into my game folder and added the following code to my script.rpy, but I have no idea what else to do, so that things will actually show up in my gallery.

Code: Select all

   
    
init:

    $ style.gallery_nav_frame.xpos = 800 - 10
    $ style.gallery_nav_frame.xanchor = 1.0
    $ style.gallery_nav_frame.ypos = 12

#My game is 640 by 480 pixels, should I modify the numbers above? 

    $ config.main_menu.insert(2, ('Gallery', "gallery", "True"))


label gallery:


# I added this bit here so that if they click the gallery button before beating the game, they'll see a BG telling them to come back later.
    if not persistent.gallery_unlocked:
        show lockedG_background
        centered "You haven't unlocked this gallery yet."
        $ renpy.full_restart()
# But maybe there was a better way of doing it, or would this be okay and not cause problems?


#Then the rest beneath is where I'm tearing my hair not knowing what to do even more. I added # in front of stuff until I get it figured out, since otherwise the game won't work.
    
    
    python hide:


        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")





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

    return
        
    
    
I might also have redundant stuff going on with the persistent thingie. :S



I'd like the gallery to look something like the ones in those games, where people can visit the gallery and see the empty spaces for the CGs not unlocked yet, and the spaces with the ones they've unlocked already:

Image

Image

Also, if anyone can point out a simple code to have the "are you sure you want to quite the game" pop-up be a nice little imagemap or some other cute custom look with an image, it would be great!!

Again, sorry for the partial thread-jacking, but since we had pretty much the same question, I figured it might be okay to ask here. ^^;

User avatar
Soraminako
Veteran
Posts: 277
Joined: Sun Sep 04, 2011 1:36 am
Projects: A thingie without a title. With messy code.
Contact:

Re: How to add a CG Gallery?

#3 Post by Soraminako » Fri Sep 09, 2011 1:34 am

*bump*

Anyone there? ^^; We need help...
(I drew my avatar especially to express the scary feeling I get from the code as I type it... XD)

User avatar
Abeiramar
Regular
Posts: 198
Joined: Wed Jul 28, 2010 10:37 am
Location: Portugal
Contact:

Re: How to add a CG Gallery?

#4 Post by Abeiramar » Fri Sep 09, 2011 2:56 pm

Soraminako wrote:*bump*

Anyone there? ^^; We need help...
http://lemmasoft.renai.us/forums/viewto ... 00#p153967

I did some sort of tutorial. Does it help?

User avatar
Soraminako
Veteran
Posts: 277
Joined: Sun Sep 04, 2011 1:36 am
Projects: A thingie without a title. With messy code.
Contact:

Re: How to add a CG Gallery?

#5 Post by Soraminako » Fri Sep 09, 2011 4:11 pm

Abeiramar wrote:
Soraminako wrote:*bump*

Anyone there? ^^; We need help...
http://lemmasoft.renai.us/forums/viewto ... 00#p153967

I did some sort of tutorial. Does it help?
It helped immensely! :D Thank you SO MUCH, you're awesome!


If you don't mind me asking more stuff when you have already helped so much, would it work if I create a custom label to make the gallery look the way the ones in the images above look? (And I just add the gallery code to that label?)
Or should I just customize its looks somewhere else? I'm thinking about a custom menu with imagebuttons and some stuff like that.
(I drew my avatar especially to express the scary feeling I get from the code as I type it... XD)

Post Reply

Who is online

Users browsing this forum: _ticlock_