Trying to set up a teleporting map.

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
LiveTurkey
Regular
Posts: 109
Joined: Tue Dec 27, 2016 10:50 pm
Location: Brooklyn
Contact:

Trying to set up a teleporting map.

#1 Post by LiveTurkey »

I am trying to set up a map where when the player clicks on a location, they will be moved there.

Here is the map code.

Code: Select all

screen map:
    imagebutton:
        idle "backgrounds/transparent.png"
        action [Hide ("map")]
        
    imagemap:
        ground "backgrounds/mapGround.png"
        idle "backgrounds/mapGround.png"
        hover "backgrounds/mapHover.png"
        alpha False
        hotspot (590, 539, 202, 166) action [Hide("map"), Jump("homeroom")]
        hotspot (879, 409, 204, 269) action [Hide("map"), Jump("hallwayOne")]
        hotspot (588, 343, 207, 186) action [Hide("map"), Jump("englishClassroom")]   


and here are the labels

Code: Select all

label homeroom:
    scene homeroom
    $ location = 'homeroom'
    show screen homeroomOptions
    call screen overlay

Code: Select all

label hallwayOne:
    scene hallwayOne
    $ location = "hallwayOne"
    show screen hallwayOneOptions
    call screen overlay

Code: Select all

label englishClassroom:
    scene englishClassroom
    $ location = 'englishClassroom'
    show screen englishClassroomOptions
    call screen overlay
It works about halfway and displays some very strange behavior.

Lets say I start in homeroom and try to teleport to hallwayOne.

This is where the first problem arises. On the surface it looks like it works. The background image is the hallwayOne image and the hallwayOneOptions screen is shown and works. The problem is the homeroomOptions screen stays but remains invisible. So I can still click on those imagebuttons even though they shouldn't be there.

Then I use the map to try to teleport back to homeroom. The second problem arises. It seems like it successfully teleports me to homeroom (location variable becomes homeroom) but the background images stays the same (the hallwayOne image so it looks like im still in the hallway) and once again both screens show (homeroomOptions and hallwayOneOptions) with again the homeroomOptions being invisible but clickable.

Does anybody know what is happening?

If I use the map to move to all three places, all three options screens show up. I'm assuming this is because every time I jump, I show a screen but never hide it. Is there a way to hide all screens before the jump in the map? That will fix the screens problem. Then the only problem left would be that the background image (scene) doesn't seem to get updated.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Trying to set up a teleporting map.

#2 Post by trooper6 »

LiveTurkey wrote: If I use the map to move to all three places, all three options screens show up. I'm assuming this is because every time I jump, I show a screen but never hide it. Is there a way to hide all screens before the jump in the map? That will fix the screens problem. Then the only problem left would be that the background image (scene) doesn't seem to get updated.
Yes, when you show a screen, unless you hide it, it stays showing. So the easy answer is to just hide your screens when you leave the location. Why aren't you doing that?

The other thing you can do is have all of those location screens share the same tag (say, for example, tag loc) then whenever one screen with the tag loc is called up, other screens with the tag loc are hidden. Documentation is here: https://www.renpy.org/doc/html/screens. ... -statement

After you fix that, then retry your program and see if the scene problem persists.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
LiveTurkey
Regular
Posts: 109
Joined: Tue Dec 27, 2016 10:50 pm
Location: Brooklyn
Contact:

Re: Trying to set up a teleporting map.

#3 Post by LiveTurkey »

trooper6 wrote:
LiveTurkey wrote: Yes, when you show a screen, unless you hide it, it stays showing. So the easy answer is to just hide your screens when you leave the location. Why aren't you doing that?
Hiding all my screens fixed both problems. Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users