Need help on bringing up a map with a key

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
final513
Regular
Posts: 33
Joined: Tue Jul 07, 2015 12:20 pm
Contact:

Need help on bringing up a map with a key

#1 Post by final513 »

So for my game, I wanna have a map that you can bring up when you hit a key, sort of like a function. Can anyone point me to where I'd figure out how to do that? Thanks.
Current Project: Alter Ego

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Need help on bringing up a map with a key

#2 Post by papiersam »

You can either set the _game_screen_menu to the map screen (which will replace the game menu), or you can have a key assigned to call the screen, something like:

Code: Select all

key "K_a" action Show("mapscrn", transition=dissolve)
Here, pygame keys are used to assign the screen to the 'a' key.

Hope that helps.

User avatar
final513
Regular
Posts: 33
Joined: Tue Jul 07, 2015 12:20 pm
Contact:

Re: Need help on bringing up a map with a key

#3 Post by final513 »

I just tried to do this, but it's giving me the end of line expected error. Am I supposed to put it in the script file or somewhere else?
Current Project: Alter Ego

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Need help on bringing up a map with a key

#4 Post by papiersam »

It goes inside a screen, so something like

Code: Select all

screen bckgrnd:
    key "K_a" action Show("mapscrn", transition=dissolve)

label start:
    show screen bckgrnd
    "Now you can call the screen in the background."
If that doesn't work, you could try to append the function to the keymap.

User avatar
final513
Regular
Posts: 33
Joined: Tue Jul 07, 2015 12:20 pm
Contact:

Re: Need help on bringing up a map with a key

#5 Post by final513 »

What exactly do you put in the parenthesis? is that an image you declare, cuz it seems to be responding to my input, but it's saying that the screen doesn't exist.

Also, let me explain what I'm trying to do so I can solve it all in one go. Each label (which in my game represents a room), the player can bring up the map but will show a different map (the map's gonna have a red dot showing where you are). So each label needs to be able to pull a different image I have setup. If you can help me with this, that'd be great.

Thanks again.
Current Project: Alter Ego

Post Reply

Who is online

Users browsing this forum: Adabelitoo, Semrush [Bot]