Doubt about Jumps and screen

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
zabuzaeldemonio
Regular
Posts: 73
Joined: Sun Jan 08, 2017 7:24 pm
Contact:

Doubt about Jumps and screen

#1 Post by zabuzaeldemonio » Sun Apr 15, 2018 9:31 pm

Greetings, I would like to know if there is any way to perform a permanent jump through a screen:

For example:

Code: Select all

screen map:
    use navi
    imagebutton auto "gui/map/zone_%s.png" xpos 390 ypos 720 action Jump('zone1') activate_sound ("musica/menu/Blip2.wav") hovered [ Play ("test_alz", "sfx/click.wav")]

This screen would make the jump to zone1, but giving it a right click would return to the screen and the initial point, so I would like it to make the jump once, hide the current screen and continue with the corresponding label.

Thanks for the help

kivik
Veteran
Posts: 234
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Doubt about Jumps and screen

#2 Post by kivik » Mon Apr 16, 2018 3:58 am

You should be able do that in the zone1 label:

Code: Select all

label zone1:
    hide screen map
    player.location = "zone1" # if you have a variable that stores player location, I'm using player.location here but you should use whatever you're using
    "Continue the game here"
Alternatively you can add the hide screen action to the button itself:

Code: Select all

    imagebutton auto "gui/map/zone_%s.png" xpos 390 ypos 720 action [Hide("map"),Jump('zone1')] activate_sound ("musica/menu/Blip2.wav") hovered [ Play ("test_alz", "sfx/click.wav")]
action can take a python list of commands.

User avatar
zabuzaeldemonio
Regular
Posts: 73
Joined: Sun Jan 08, 2017 7:24 pm
Contact:

Re: Doubt about Jumps and screen

#3 Post by zabuzaeldemonio » Mon Apr 16, 2018 2:05 pm

Could you tell me more about?

Code: Select all

player.location = "zone1"

kivik
Veteran
Posts: 234
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Doubt about Jumps and screen

#4 Post by kivik » Mon Apr 16, 2018 4:41 pm

zabuzaeldemonio wrote:
Mon Apr 16, 2018 2:05 pm
Could you tell me more about?

Code: Select all

player.location = "zone1"
That's just if you have a variable that does extra things based on where your player's current location is. For example your game may want to check where the player is whenever they move to a room, you'll want to have a variable to store that.

I used player.location just as an example. In my example you'll basically have a player object that stores various information about the player (stats, location, cash, etc) then you can easily access it by calling player.variable_name. Alternatively you can just have variables named player_location, player_cash, player_health etc. I just prefer to put everything in objects myself.

User avatar
zabuzaeldemonio
Regular
Posts: 73
Joined: Sun Jan 08, 2017 7:24 pm
Contact:

Re: Doubt about Jumps and screen

#5 Post by zabuzaeldemonio » Mon Apr 16, 2018 6:14 pm

Could you give a simple example of how to store the place and then how to use it? I've really only used the basic variables like, Variable = True, and the analysis of the use of the If

kivik
Veteran
Posts: 234
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Doubt about Jumps and screen

#6 Post by kivik » Mon Apr 16, 2018 6:36 pm

I can't really tell you without knowing how you're handling locations in your game. If you don't use any variables to store your player location then it may be completely pointless.

If I were to give you a very simple example (not tested), this code should allow your player to move around by calling the move_player() label and automatically change the background.

Code: Select all

default player = Character(None)
define locations = {"bedroom": "The Bedroom", "living_room": "Living Room", "kitchen": "Kitchen"}
image bg bedroom = "bedroom.png"
image bg living_room = "living_room.png"
image bg kitchen = "kitchen.png"

label start:
    call move_player("bedroom") #
    "I'm now in [player.location]"
    return

label move_player(location):
    $ player.location = locations[location]
    scene expression "bg [location]"
    return

User avatar
zabuzaeldemonio
Regular
Posts: 73
Joined: Sun Jan 08, 2017 7:24 pm
Contact:

Re: Doubt about Jumps and screen

#7 Post by zabuzaeldemonio » Mon Apr 16, 2018 6:47 pm

Thanks, I think I can get an idea of ​​how to use it, now it only remains to see if even clicking on the right returns to the point where I open the screen or stay in the new place.

philat
Eileen-Class Veteran
Posts: 1293
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Doubt about Jumps and screen

#8 Post by philat » Mon Apr 16, 2018 9:06 pm

Don't show your screens using ShowMenu.

User avatar
zabuzaeldemonio
Regular
Posts: 73
Joined: Sun Jan 08, 2017 7:24 pm
Contact:

Re: Doubt about Jumps and screen

#9 Post by zabuzaeldemonio » Mon Apr 16, 2018 11:09 pm

Okey, I ll use Show, then.

Post Reply

Who is online

Users browsing this forum: KingsCard