[SOLVED]How do I make an imagemap insensitive?

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
GammaBreak
Regular
Posts: 62
Joined: Thu Aug 06, 2020 10:04 pm
Contact:

[SOLVED]How do I make an imagemap insensitive?

#1 Post by GammaBreak »

I'm working on a character select screen of sorts where the player selects a character, progresses down a path, and eventually winds up at the same character select once that arc is completed. I'm trying to do the following:

1. Active characters are colored.
2. When mouse-hovered, the character have a glow border.
3. Characters already completed are grayscale.

I've figured out steps 1 and 2 easily enough, but I'm still scratching my head on how to do 3. I can't find any good examples on how to make an imagemap insensitive. Below is my code, just trying this with one character at the moment.

Code: Select all

label start:
    $ char1_path = False
    $ char2_path = False
    $ char3_path = False
    $ char4_path = False
    $ char5_path = False
    $ path = ""

    label pickpath:
        scene black
        call screen path_select(char1_path , char2_path , char3_path , char4_path , char5_path ) with dissolve
        $ path = _return
        if path == "char1_path ":
            n "You have selected Character 1's path."
            $ char1_path == True
            
        #make label to jump to relevant path here
        jump pickpath

Code: Select all

screen path_select(char1_path , char2_path , char3_path , char4_path , char5_path ):
    imagemap:
        xalign 0.5 yalign 0.5
        idle "images/nav/select_idle.png"
        hover "images/nav/select_hover.png"
        insensitive "images/nav/select_completed.png"
        
        hotspot(1196, 164, 1727, 1080) action Return("char1_path ")
        
This works fine, as it lets me select character 1 and activates the correct logic. However, once I hit the menu again, character 1 needs to be grayscale and the hotspot not active.
Last edited by GammaBreak on Wed Jan 13, 2021 6:44 pm, edited 1 time in total.

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: How do I make an imagemap insensitive?

#2 Post by _ticlock_ »

Hi, GammaBreak,

You can make the button insensitive by omissing action or action None:

Code: Select all

imagemap:
        xalign 0.5 yalign 0.5
        idle "images/nav/select_idle.png"
        hover "images/nav/select_hover.png"
        insensitive "images/nav/select_completed.png"
        
        hotspot(1196, 164, 1727, 1080) action (Return("char1_path ") if <expression to check if sensitive> else None)


GammaBreak
Regular
Posts: 62
Joined: Thu Aug 06, 2020 10:04 pm
Contact:

Re: How do I make an imagemap insensitive?

#4 Post by GammaBreak »

_ticlock_ wrote: Wed Jan 13, 2021 12:29 am Hi, GammaBreak,

You can make the button insensitive by omissing action or action None:

Code: Select all

imagemap:
        xalign 0.5 yalign 0.5
        idle "images/nav/select_idle.png"
        hover "images/nav/select_hover.png"
        insensitive "images/nav/select_completed.png"
        
        hotspot(1196, 164, 1727, 1080) action (Return("char1_path ") if <expression to check if sensitive> else None)
This worked, thanks! I didn't fully understand the if expression when I first wrote it, but I think I do now.

Post Reply

Who is online

Users browsing this forum: No registered users