Help regarding Moving from one Room/Place to Another.

joybosa

Newbie
Jan 6, 2018
92
52
Hey! I am new in game developing.I am creating demo game for learning purpose. Can anyone help How to move from one room to another room??? I want to display image-button like small icons at the left-bottom corner with different person's name or face.
When user click on any image button that person's room's image should be displayed.
 
  • Like
Reactions: Palanto

Papa Ernie

Squirrel!?
Uploader
Donor
Dec 4, 2016
12,333
48,131
Hey! I am new in game developing.I am creating demo game for learning purpose. Can anyone help How to move from one room to another room??? I want to display image-button like small icons at the left-bottom corner with different person's name or face.
When user click on any image button that person's room's image should be displayed.
My advice to you is go look at other games' code to see what other programmers did.
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
Hey! I am new in game developing.I am creating demo game for learning purpose. Can anyone help How to move from one room to another room??? I want to display image-button like small icons at the left-bottom corner with different person's name or face.
When user click on any image button that person's room's image should be displayed.
My advice to you is go look at other games' code to see what other programmers did.
Jerricho is right, check other games for how they'd do it or read up about imagebuttons, labels and screens in the renpy documentation. Since that's actually all you need for the mentioned task. A screen with an imagebutton with an action to jump to a label which has the scene inside it that you want to show to the players:
Code:
screen mapScreen():
    *code to place everything where you want it and adding a background and so on*

    imagebutton auto "girlfriends_door_%s.png" action Jump("girlfriendsRoom") pos(864, 403)



label girlfriendsRoom:
    scene imageName
    with transition

    "Wow, her room is so tidy, she's the perfect wife material! *Yeah I know, damn sexist*"
 

Vexon731

Newbie
Jul 9, 2018
19
110
I do this today too, here is an example with image maps:
Code:
# The script of the game goes in this file.

# Declare characters used by this game. The color argument colorizes the
# name of the character.

define d = Character("Daryl")
define r = Character("Receptionist")

screen imagemap_office():
    imagemap:
        idle 'office.jpg'
        hover 'officehover.jpg'
        alpha False

        hotspot(891, 309, 185, 538) action Jump("entrance") alt "Entrance"
        hotspot(1260, 630, 200, 320) action Jump("newspaper") alt "Newspaper"
        hotspot(1663, 340, 200, 400) action Jump("go") alt "Go"

screen imagemap_officelobby():
    imagemap:
        idle 'officelobby.jpg'
        hover 'officelobbyh.jpg'
        alpha False

        hotspot(1685, 8, 220, 120) action Jump("start2") alt "Start2"

# The game starts here.

label start:

    show black with dissolve

    "You've created a new Ren'Py game."

    # Call the imagemap_example screen.
label start2:

label imagemap_office:
    call screen imagemap_office

label entrance:

    d "Bemegyek az irodába."

label imagemap_officelobby:
    call screen imagemap_officelobby

    d "Senki sincs itt."
    d "Körbenézek"

label newspaper:

    show black

    d "Megnézem az újságot"

    scene newspaper

    d "Valaki még olvassa ezeket?"

    jump imagemap_done

label go:

    d "Elindulok arra."

    show go

    d "Micsoda szarfészek"


    jump imagemap_done

label imagemap_done:

    d "Once you add a story, pictures, and music, you can release it to the world!"
    # This ends the game.
    return
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
ugh my eyes....

sorry please use the code function here :)
[ code ][ /code ]
 

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
ok without the spaces the first [ code ] has to be in front of the code text and the second [ /code ] has to be at the end of the code ;) But like I said, remove the spaces from it :D I just don't know how to write those commands without them activating a codebox anymore :D
 

joybosa

Newbie
Jan 6, 2018
92
52
I do this today too, here is an example with image maps:
Code:
# The script of the game goes in this file.

# Declare characters used by this game. The color argument colorizes the
# name of the character.

define d = Character("Daryl")
define r = Character("Receptionist")

screen imagemap_office():
    imagemap:
        idle 'office.jpg'
        hover 'officehover.jpg'
        alpha False

        hotspot(891, 309, 185, 538) action Jump("entrance") alt "Entrance"
        hotspot(1260, 630, 200, 320) action Jump("newspaper") alt "Newspaper"
        hotspot(1663, 340, 200, 400) action Jump("go") alt "Go"

screen imagemap_officelobby():
    imagemap:
        idle 'officelobby.jpg'
        hover 'officelobbyh.jpg'
        alpha False

        hotspot(1685, 8, 220, 120) action Jump("start2") alt "Start2"

# The game starts here.

label start:

    show black with dissolve

    "You've created a new Ren'Py game."

    # Call the imagemap_example screen.
label start2:

label imagemap_office:
    call screen imagemap_office

label entrance:

    d "Bemegyek az irodába."

label imagemap_officelobby:
    call screen imagemap_officelobby

    d "Senki sincs itt."
    d "Körbenézek"

label newspaper:

    show black

    d "Megnézem az újságot"

    scene newspaper

    d "Valaki még olvassa ezeket?"

    jump imagemap_done

label go:

    d "Elindulok arra."

    show go

    d "Micsoda szarfészek"


    jump imagemap_done

label imagemap_done:

    d "Once you add a story, pictures, and music, you can release it to the world!"
    # This ends the game.
    return
Thanks. Now I will apply it.
 
  • Like
Reactions: Palanto

Palanto

Active Member
Game Developer
Oct 4, 2017
964
1,841
You shouldn't use imagemaps since they are old and deprecated... They still work but noone knows how long they will anymore... ;) Play this example game and look at it's code for examples of how you could create stuff with the newer and better version called imagebuttons:

It shows what you can do with those buttons and what you wouldn't be able to with imagemaps. (Being the reason why imagemaps aren't developed by ren'py anymore..)

btw. best thing you can do is put that forum in a bookmark, it's the best source for ren'py issues and solutions.
 
  • Like
Reactions: joybosa

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,976
16,231
Just one thing to add :

Look how other games do it, but do not limit it to a single game.
There's many way to do things with Ren'py, and some are really awful, when they aren't simply ignoring how Ren'py effectively works (hello "show screen [...] while True: pause"). So, by looking a many games, you increase your chance to finally use an effective and bug free solution.
 
  • Like
Reactions: joybosa and Palanto

joybosa

Newbie
Jan 6, 2018
92
52
You shouldn't use imagemaps since they are old and deprecated... They still work but noone knows how long they will anymore... ;) Play this example game and look at it's code for examples of how you could create stuff with the newer and better version called imagebuttons:

It shows what you can do with those buttons and what you wouldn't be able to with imagemaps. (Being the reason why imagemaps aren't developed by ren'py anymore..)

btw. best thing you can do is put that forum in a bookmark, it's the best source for ren'py issues and solutions.
Thanks Palanto for sharing a very important forum with me.
 

joybosa

Newbie
Jan 6, 2018
92
52
Just one thing to add :

Look how other games do it, but do not limit it to a single game.
There's many way to do things with Ren'py, and some are really awful, when they aren't simply ignoring how Ren'py effectively works (hello "show screen [...] while True: pause"). So, by looking a many games, you increase your chance to finally use an effective and bug free solution.
Thanks.I will try remember it.