imagemap, hotspot and 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
alex.theoto
Regular
Posts: 49
Joined: Sun Sep 13, 2015 3:11 pm
Location: Greece
Contact:

imagemap, hotspot and gallery

#1 Post by alex.theoto » Sun Jan 22, 2017 6:29 am

Hello.
I'm trying to make a gallery but the gallery screen has asymmetric boxes. So, I think imagemap is the right option.
The problem is that I don't understand how to set the unlocked image.

gallery.rpy is like:

Code: Select all

image ian1 = "cg/ian1.jpg"

init python:
    
    # Step 1. Create the gallery object.
    g = Gallery()

    # Step 2. Add buttons and images to the gallery.

    g.button("ian1")
    g.image("ian1")
    g.unlock("ian1")



screen gallery():
    tag menu
    imagemap:
        ground "gui/Gallery/Gallery Final - ground.png"
        hover "gui/Gallery/Gallery Final - hover.png"
        selected_idle "gui/Gallery/Gallery Final - selected idle.png"

        
        alpha False

        hotspot (243, 229, 255, 136) action g.button("ian1")
And (if I understood correct) when the image 'ian1' showed at script, the image should be unlocked.
But this doesn't happens.
My script.rpy is like:

Code: Select all

    scene ian1
    centered "Ian CG is unlocked"
Can someone help me to understand how gallery works?
Last edited by alex.theoto on Fri Feb 03, 2017 2:34 pm, edited 1 time in total.

User avatar
Ocelot
Miko-Class Veteran
Posts: 849
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: imegemap, hotspot and gallery

#2 Post by Ocelot » Sun Jan 22, 2017 7:09 am

g.button creates a new category for your images. It cannot be used as an action. I am surprised that this worked at all.

If you want a button action corresponding to gallery button action, use it: https://www.renpy.org/doc/html/rooms.ht ... ery.Action

Code: Select all

g.Action('ian1')
< < insert Rick Cook quote here > >

alex.theoto
Regular
Posts: 49
Joined: Sun Sep 13, 2015 3:11 pm
Location: Greece
Contact:

Re: imegemap, hotspot and gallery

#3 Post by alex.theoto » Sun Jan 22, 2017 7:36 am

Yes, that worked. Thanks.
Now I have to find out how to set the unlocked image. I'll read the wiki carefully again and if I stick again I'll post again.

Thanks...

User avatar
Scribbles
Miko-Class Veteran
Posts: 627
Joined: Wed Sep 21, 2016 4:15 pm
Completed: Pinewood Island, As We Know It
Projects: In Blood
Organization: Jaime Scribbles Games
Deviantart: breakfastdoodles
itch: scribbles
Location: Ohio
Contact:

Re: imegemap, hotspot and gallery

#4 Post by Scribbles » Sun Jan 22, 2017 9:00 pm

Have you had any luck? I *just* figured out a gallery for my game but it's far from perfect.

Code: Select all

init python:

    # Step 1. Create the gallery object.
    g = Gallery()

    # Step 2. Add buttons and images to the gallery.

###### MATT ###########
    g.button("m01")
    g.condition("persistent.mcg01")
    g.image("matt01")
and then under the gallery screen:

Code: Select all

screen matt_gallery():
    tag menu
    use game_menu(_("Page 1"), scroll="viewport"):
        
        vbox:
            add g.make_button("m01","Cgs/CGplaceholder.png", "Cgs/lockedCG.png", xalign=0.5, yalign=0.5)
obviously this is for my character Matt lol but hopefully that gives you a bit of an idea. it took me a full day just to set up this, and it's not perfect..... but if it helps great

in the script when the CG is unlocked:

Code: Select all

$ persistent.mcg01 = True
I hope that helped? maybe?
Image - Image -Image

Post Reply

Who is online

Users browsing this forum: Adrian_DVL, ShadoStalk3r