Frame and Masking/Cropping help

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
User avatar
mxrio
Newbie
Posts: 5
Joined: Sun Feb 04, 2018 7:38 am
Github: Mxrio
Contact:

Frame and Masking/Cropping help

#1 Post by mxrio »

I'm attempting to have two large images within boxes undergo transforms but stay within a set of bounds i've placed, ideally half of the screen.
Image 1 shows how it is when the boxes are placed with a frame and separated at the halfway point.
However when I attempt to use a transform on the second frame created, the image ends up filling the whole screen instead of staying within the frame (Image 2).
Image 3 shows how I would like it to look, restricting it so I can move the boxes freely but keep what is actually displayed within the frame. I understand the only reason this one works is because the second frame is built on top of the first. My question is, how do I make it so both the images are only displayed through the bounds of the frame without actually cropping the image itself, so I can use transforms on them at another time.

https://imgur.com/a/brpIo

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Frame and Masking/Cropping help

#2 Post by Remix »

Though you could use LiveCrop (which updates each time it is drawn) you are probably looking at using a Viewport with the image set as an offset background...

Pseudo code (might need some tweaks)

Code: Select all

screen two_pics():
    hbox:
        frame:
            area (0,0,320,320)
            viewport id "left_side":
                draggable True
                scrollbars None
                add "images/bg 99.png" anchor (0.5,0.5) xpos 160 ypos 160
        frame:
            area (0,0,320,320)
            viewport id "right_side":
                draggable True
                scrollbars None
                add "images/bg 98.png" anchor (0.5,0.5) xpos 160 ypos 160
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Google [Bot], voluorem