Buttons in Edgescroll screen help

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
valentin
Newbie
Posts: 12
Joined: Mon Jul 22, 2013 11:44 am
Contact:

Buttons in Edgescroll screen help

#1 Post by valentin »

Hello, so I wanted to eventually make a map screen that uses edge scroll and image buttons. You put your mouse to the edge and as it scrolls you can see the various places you can click on. I was just testing out the code, and I can't figure out why it wouldn't work. Here's what I had:

Code: Select all


screen edgescroll_screen:
    viewport:
        edgescroll (100, 500)
        add "bg/forest/sun_thru_trees.jpg" at truecenter
        
        vbox:
                xpos 100
                ypos 200
                textbutton _("Test"):
                   action Return(True)
       
call screen edgescroll_screen
The edge scroll works fine until I put the vbox in. If the vbox code is there, it won't scroll. If just the text button code is there, I receive an error like viewport doesn't accept this action or something. Is what I'm trying to do not possible?

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Buttons in Edgescroll screen help

#2 Post by Milkymalk »

The problem here is the indentation. Make vbox a child of the screen, not the viewport:

Code: Select all

screen edgescroll_screen:
    viewport:
        edgescroll (100, 500)
        add "bg/forest/sun_thru_trees.jpg" at truecenter
       
    vbox:
        xpos 100
        ypos 200
        textbutton _("Test"):
           action Return(True)
       
call screen edgescroll_screen
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

valentin
Newbie
Posts: 12
Joined: Mon Jul 22, 2013 11:44 am
Contact:

Re: Buttons in Edgescroll screen help

#3 Post by valentin »

I tried that, but when I do that, the button doesn't scroll with the image.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Buttons in Edgescroll screen help

#4 Post by Milkymalk »

valentin wrote:I tried that, but when I do that, the button doesn't scroll with the image.
OK, I understand what you want now.

Blind guessing now. I'd try:

Code: Select all

screen edgescroll_screen:
    viewport:
        edgescroll (100, 500)
        add "bg/forest/sun_thru_trees.jpg" at truecenter
        textbutton "Test" xpos 100 ypos 200 action Return(True)
       
call screen edgescroll_screen
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Buttons in Edgescroll screen help

#5 Post by PyTom »

So, the issue here is that when you put two things inside a viewport, Ren'Py creates a Fixed to put them in. That Fixed is the size of the screen, which is too small to contain everything inside the viewport.

I'd suggest that what you want is the child_size argument to viewport:

Code: Select all

screen edgescroll_screen:
    viewport:
        child_size (1024, 1024) # size of sun_thru_trees.jpg
        edgescroll (100, 500)
        add "bg/forest/sun_thru_trees.jpg"
        textbutton "Test" xpos 100 ypos 200 action Return(True)
       
call screen edgescroll_screen

Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

valentin
Newbie
Posts: 12
Joined: Mon Jul 22, 2013 11:44 am
Contact:

Re: Buttons in Edgescroll screen help

#6 Post by valentin »

Thank you to you both, I'll try your suggestions.

Post Reply

Who is online

Users browsing this forum: Imperf3kt, Majestic-12 [Bot], voluorem