Page 1 of 1

Doubt about Jumps and screen

Posted: Sun Apr 15, 2018 9:31 pm
by zabuzaeldemonio
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

Re: Doubt about Jumps and screen

Posted: Mon Apr 16, 2018 3:58 am
by kivik
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.

Re: Doubt about Jumps and screen

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

Code: Select all

player.location = "zone1"

Re: Doubt about Jumps and screen

Posted: Mon Apr 16, 2018 4:41 pm
by kivik
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.

Re: Doubt about Jumps and screen

Posted: Mon Apr 16, 2018 6:14 pm
by zabuzaeldemonio
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

Re: Doubt about Jumps and screen

Posted: Mon Apr 16, 2018 6:36 pm
by kivik
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

Re: Doubt about Jumps and screen

Posted: Mon Apr 16, 2018 6:47 pm
by zabuzaeldemonio
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.

Re: Doubt about Jumps and screen

Posted: Mon Apr 16, 2018 9:06 pm
by philat
Don't show your screens using ShowMenu.

Re: Doubt about Jumps and screen

Posted: Mon Apr 16, 2018 11:09 pm
by zabuzaeldemonio
Okey, I ll use Show, then.