Edgescroll speed

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
Exiscoming
Regular
Posts: 113
Joined: Tue Apr 29, 2014 5:37 pm
Contact:

Edgescroll speed

#1 Post by Exiscoming » Fri Oct 09, 2020 8:29 am

I'm trying to make a map where you can look around in by moving your cursor to the edge of the screen.
However, right now the speed at which the map moves is really slow.

The wiki says:
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. The default function returns its input, and implements proportional scrolling. A function that returned -1.0 or 1.0 based on the sign of its input would implement constant-speed scrolling.
Can someone give me an example of how to do this? An old thread already got me started with:

Code: Select all

init python:
    def speed_scroll(i):
        return i

screen city():
    viewport:
        edgescroll (400, 500, speed_scroll)

User avatar
RicharDann
Veteran
Posts: 239
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Edgescroll speed

#2 Post by RicharDann » Fri Oct 09, 2020 10:29 am

Not sure if this is what you want, but you can try increasing the second value of the tuple, the scrolling rate in pixels per second, this would basically increase the scroll speed.

Code: Select all

viewport:
    edgescroll (400, 2000, speed_scroll)
The most important words a man can say are, “I will do better.”

Exiscoming
Regular
Posts: 113
Joined: Tue Apr 29, 2014 5:37 pm
Contact:

Re: Edgescroll speed

#3 Post by Exiscoming » Fri Oct 09, 2020 10:54 am

Edit: Now I get it. I've been doing it all wrong.

I thought the 1 parameters was the X axis and the second the Y. Then the third being the speed.
Turns out the first is just the distance to the edge of your screen and the second is your speed.

Okay it's fixed now. Thank you!

Post Reply

Who is online

Users browsing this forum: djinius