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.
I've been struggling to find a way to update a screen, once the horizontal scroll value for a viewport has been adjusted. The idea here is to apply a transform to a displayable, using the value of the viewport adjustment:
image bg = "images/background.png"
image character = "images/character.png"
transform left_to_right(begin, end):
xpos begin
easein 0.5 xpos end
screen viewport_example():
$ adjust = ui.adjustment()
viewport:
id "vp"
child_size (1800, 600)
draggable True
arrowkeys True
xadjustment adjust
fixed:
add "bg"
add "character" at left_to_right(left_to_right.xpos, adjust.value)
If I manage the adjustment through an action that changes a variable, everything works, but this doesn't account for adjustments made using arrow keys or by dragging the mouse within the viewport.
Can anyone suggest a way to update the screen whenever the adjustment changes?