Page 1 of 1

Edgescroll speed

Posted: Fri Oct 09, 2020 8:29 am
by Exiscoming
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)

Re: Edgescroll speed

Posted: Fri Oct 09, 2020 10:29 am
by RicharDann
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)

Re: Edgescroll speed

Posted: Fri Oct 09, 2020 10:54 am
by Exiscoming
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!