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.
The background image is wider than the window and I want the images (gradient left/right) to only show when the viewport is in the middle. What's the workaround for this? I've tried XScrollValue(), but that returns a bar value.
jwideman wrote: ↑Thu Aug 29, 2019 3:54 pm
The background image is wider than the window and I want the images (gradient left/right) to only show when the viewport is in the middle. What's the workaround for this? I've tried XScrollValue(), but that returns a bar value.
By "viewport in the middle", you mean when the scrollbar of the viewport is in the middle? Actually, it's not really clear for me what you're trying to achieve here. Care to elaborate more?
I thought it should be obvious from the code. Okay, a visual aid then:
This is resized for the forum, but it's 3200 pixels wide. The areas in red are off the screen. That's the middle of the viewport. Those gradients are what I want on the screen when it's in this position.
Notice how the gradient on the left disappears? That's what I want to happen.
The problem is that you are not actually redrawing the entire screen when you drag or scroll, so even if you had the viewport x position the overlay would not naturally update.
I'd suggest using DynamicDisplayables (which update themselves even if screen isn't redrawn)...
Mostly working. Only things I had to fix were it's kwargs['side'] not kwargs.['side'], and it uses the size of the screen (1280) not the size of of the background image (2560).
Thanks!