Ren'Py Edge scroll stopping

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,548
Hey all, I have followed a youtube tut on making an edge scroll with a mouse area, all works as intended, here is the code I am using.

Python:
screen edgescroll_screen():
    mousearea:
        area(0,0,100,1080)
        hovered SetVariable("xp", xp+5), Return()


    mousearea:
        area(1820,0,1920,1080)
        hovered SetVariable("xp", xp-5), Return()


    mousearea:
        area(100,0,1820,100)
        hovered SetVariable("yp", yp+5), Return()


    mousearea:
        area(100,980,1820,1080)
        hovered SetVariable("yp", yp-5), Return()
Question is, how can I stop the image that is scrolling stop at the edge of the screen instead of disappearing into an abyss?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,355
15,269
Question is, how can I stop the image that is scrolling stop at the edge of the screen instead of disappearing into an abyss?
By conditioning your actions. Something like :
Code:
       hovered If( yp > LIMIT_VALUE - 5, SetVariable("yp", yp-5), NullAction() ), Return()
 
  • Like
Reactions: mickydoo