Edgescrolling

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
Luxee
Newbie
Posts: 13
Joined: Mon May 21, 2018 5:02 pm
Projects: Parental Love, Apartment #69
Contact:

Edgescrolling

#1 Post by Luxee » Sun Sep 02, 2018 12:31 pm

Hi, I'm having a bit of trouble getting edgescrolling to work. I've been reading this part of the documentation https://www.renpy.org/doc/html/screens.html#viewport . But I feel like I'm missing something.
I'm trying to make the game's main menu image in to an edgescroll thingy. Here's the code I'm working with

Code: Select all

screen main_menu():

    ## This ensures that any other menu screen is replaced.
    tag menu

    style_prefix "main_menu"
    viewport:
        edgescroll (400, 500, 1.0)
        add randmenui
(randmenui is defined before)

If I run this code, I get to the main menu all fine. Then, as soon as I move my mouse, it gives me "TypeError: 'float' object is not callable"
If I remove the third number from edgescroll, the ", 1.0" it doesn't crash, and works fine. But of course, without the third number, it kind of feels and looks dumb.

Any of you gotten the third element of edgescroll working?

User avatar
MaydohMaydoh
Regular
Posts: 165
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: Edgescrolling

#2 Post by MaydohMaydoh » Sun Sep 02, 2018 7:15 pm

"If present, the third element is a function that adjusts the scrolling speed, based on how close to the pointer is to an edge. The function should take a number between -1.0 and 1.0, and return a number in the same range."

So just make a function that returns the value it's given for a simple speed adjustment.

Code: Select all

init python:
    def speed_scroll(i):
        return i
        
screen main_menu():

    ## This ensures that any other menu screen is replaced.
    tag menu

    style_prefix "main_menu"
    viewport:
        edgescroll (400, 500, speed_scroll)
        add randmenui

Luxee
Newbie
Posts: 13
Joined: Mon May 21, 2018 5:02 pm
Projects: Parental Love, Apartment #69
Contact:

Re: Edgescrolling

#3 Post by Luxee » Sun Sep 02, 2018 7:35 pm

Ah. Now that makes a lot of sense. Guess I didn't read it closely enough :P

Thanks for the help bud

Post Reply

Who is online

Users browsing this forum: No registered users