Overlay of images

Evildad

Member
Jan 7, 2019
113
218
Google translator
Good day. I need help or advice again.
I finished the first day of my game (v0.1 prologue) and have now started developing the sandbox mode. In the meantime I have managed to integrate a time system and quests that can be processed. And it even works ^^ (Without Python).
Now I'm working on a prototype for a tablet including a map. That also works quite well so far.
However, the problem has now crept into the map that the img overlays in some situations.
So I click on a destination where I arrive, but sometimes the wrong img is displayed or the text and the menu are not displayed. If you then click, for example, with the right mouse button, you will not go to the game option, but will return to the previous screen.
But if I now do the whole thing via a renpy menu, I don't have the error.

I think that has something to do with the fact that I am not able to hide the previous ing with the map variant.

Any idea how I can solve the problem?

You don't have permission to view the spoiler content. Log in or register now.

You don't have permission to view the spoiler content. Log in or register now.

You don't have permission to view the spoiler content. Log in or register now.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,384
15,294
Firstly:
Code:
label start:
    show B
    show screen menuebotten
    "placeholder"
    hide B
    show C
    "placeholder"
    "placeholder"
    hide C
    show D
    "placeholder"
Since you hide "B" before showing "C", and do not show something else before "B", I assume that the images take the whole screen. Therefore, you should use in place of show.
As a side effect, you'll not anymore have to hide the previous image, Ren'py will do it for you. What lead to this :
Python:
label maptest:
    scene A      # <-- Changed to /scene/
    show screen menuebotten
    menu home:
        "Go bathroom":
            #hide A       <-- Not needed anymore
            jump bathroom
        "Go kitchen":
            #hide A       <-- Not needed anymore
            jump kitchen

Secondly :
Code:
label kitchen:
   show screen menuebotten
   show E
    "Test kitchen"
    window hide
    $ renpy.pause(hard=True)
You are, alas, far to be the only one, but people should really stop to copy/paste too blindly. One guy never took the time to read the documentation and came to a half broke solution, and now it spread everywhere :( This is absolutely not the way to do, Ren'py have a statement dedicated to what you want to do, .
The sad part being that, like the solution is half broke and more complex that it should, many author end abandoning their game, because they stugle too much to make it works like they want. This will using call screen would make their life way easier, and their code more obvious.

It imply a total change in the logic of your code, but also way less risk of problems :
Python:
#  A little addition. This keep track of the actual location of the player.
default currentLocation = None

label start:
    scene B
    "placeholder"
    scene C    # <-- Automatically replace 'B' by 'C'.
    "placeholder"
    "placeholder"
    scene D    # <-- Automatically replace 'C' by 'D'.
    "placeholder"
    # Display the free roaming map for the house,
    # then wait until the player click a button.
    # Like no button have /Return()/ as action, you will
    # never ever come back here, so it's 100% safe.
     call screen mapHouse
  
label maptest:
    scene A    # <-- Automatically replace whatever scene was visible by 'A'.
    # Display a different free roaming map. Since the map is
    # "called" each time you need it, you don't need a bunch of /if/,
    # just have a map for each "group of location". Therefore, one for
    # the house, one global for the outside, one for the forest, and so on.
    $ currentLocation = None   # <-- The player is nowhere.
    call screen mapOutside
  
label kitchen:
   scene E    # <-- Automatically replace whatever scene was visible by 'E'.
    "Test kitchen"
    $ currentLocation = "kitchen" # <-- The player is in the kitchen.
    call screen mapHouse

label bathroom:
   scene E   # <-- Automatically replace whatever scene was visible by 'E'.
    "Test bathroom"
    $ currentLocation = "bathroom" # <-- The player is in the bathroom.
    call screen mapHouse


# I'll use /textbutton/ for a better understanding, but it
# works the same with /imagemap/ and /imagebutton/.
screen mapHouse():
    vbox:
        textbutton "kitchen":
            action Jump( "kitchen" )   # <-- Will send the player to the "kitchen" label.
            #  The button will be clickable only if the player is NOT in the kitchen.
            sensitive currentLocation != "kitchen" 
        textbutton "bathroom":
            action Jump( "bathroom" )
            #  The button will be clickable only if the player is NOT in the bathroom.
            sensitive currentLocation != "bathroom"
        textbutton "Go outside":
            action Jump( "maptest" )
Change your code to follow this logic, and I assume that it should also solve your problem. If it don't solve it, come back with the new code.
 

Evildad

Member
Jan 7, 2019
113
218
OK thank you.
scene instead of show seems to solve the problem. It will definitely take a while until I have completely rewritten the code.
A lot, a lot of work. But then at least it's reasonable.