CG with several scenes.

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
AoiMF
Newbie
Posts: 15
Joined: Sun Mar 31, 2019 2:39 am
Contact:

CG with several scenes.

#1 Post by AoiMF » Thu Jul 25, 2019 2:15 am

Hey guys. I found a new problem.
I want every CG to have different scenes.
For example, in a gallery, a CG lock is unlocked. When I click on it. Show it. When you click again on the picture, go to the next scene.
Something like that.
This is my code:

Code: Select all

init python:
    #Galleries settings - start
    #list the CG gallery images here:
    gallery_cg_items = ["cg1", "cg2", "cg3", "cg4"]
    #list the BG gallery images here (if a BG includes several variations, such as night version, include only one variation here):
    #how many rows and columns in the gallery screens?
    gal_rows = 3
    gal_cols = 3
    #thumbnail size in pixels:
    thumbnail_x = 267
    thumbnail_y = 150
    #the setting above (267x150) will work well with 16:9 screen ratio. Make sure to adjust it, if your are using 4:3 or something else.
    #Galleries settings - end
    
    gal_cells = gal_rows * gal_cols    
    g_cg = Gallery()
    for gal_item in gallery_cg_items:
        g_cg.button(gal_item + " butt")
        g_cg.image(gal_item)
        g_cg.unlock(gal_item)
    g_cg.transition = fade
    cg_page=0
    
init +1 python:
    #Here we create the thumbnails. We create a grayscale thumbnail image for BGs, but we use a special "locked" image for CGs to prevent spoilers.
    for gal_item in gallery_cg_items:
        renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), thumbnail_x, thumbnail_y))
screen cggallery:
    tag menu   
    imagemap:
        ground 'menu/cg_gallery.png' 
        cache False     
       
        hotspot (535, 676, 131, 38) action ShowMenu('preferences') hovered Play ("first", "music/sfx/Click.wav")
        hotspot (443, 676, 71, 33) action ShowMenu('load') hovered Play ("s", "music/sfx/Click.wav")
        hotspot (799, 676, 97, 33) action ShowMenu('extras') hovered Play ("d", "music/sfx/Click.wav")
        hotspot (252, 676, 168, 33) action MainMenu() hovered Play ("a", "music/sfx/Click.wav")
        hotspot (915, 676, 77, 38) action Quit() hovered Play ("e", "music/sfx/Click.wav")
        hotspot (673, 676, 100, 29) action Return() hovered Play ("w", "music/sfx/Click.wav")
        

        grid gal_rows gal_cols:
            xpos 230
            ypos 100
            $ i = 0
            $ next_cg_page = cg_page + 1            
            if next_cg_page > int(len(gallery_cg_items)/gal_cells):
                $ next_cg_page = 0
            for gal_item in gallery_cg_items:
                $ i += 1
                if i <= (cg_page+1)*gal_cells and i>cg_page*gal_cells:
                    add g_cg.make_button(gal_item + " butt", gal_item + " butt", im.Scale("gallocked.png", thumbnail_x, thumbnail_y), xalign=0.5, yalign=0.5, idle_border=None, background=None, bottom_margin=24)
            for j in range(i, (cg_page+1)*gal_cells): #we need this to fully fill the grid
                null
        frame:
            yalign 0.9
            xalign 0.05
            vbox:
                if len(gallery_cg_items)>gal_cells:
                    textbutton _("Next Page") action [SetVariable('cg_page', next_cg_page), ShowMenu("cg_gallery")]
                   
Thanks if you help.
And sorry for bad English and bad explanation.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]