Page 1 of 1

[SOLVED]How do I make an imagemap insensitive?

Posted: Tue Jan 12, 2021 9:40 pm
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.

Re: How do I make an imagemap insensitive?

Posted: Wed Jan 13, 2021 12:29 am
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)

Re: How do I make an imagemap insensitive?

Posted: Wed Jan 13, 2021 2:21 am
by philat

Re: How do I make an imagemap insensitive?

Posted: Wed Jan 13, 2021 6:44 pm
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.