Viewport position

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
BrotherKerubim
Newbie
Posts: 11
Joined: Sun Oct 31, 2021 2:09 pm
Contact:

Viewport position

#1 Post by BrotherKerubim »

Hello, guys. Guess I need some little help here.
I'm using several viewports in my screen in order to achieve 3d effect when you edgescroll it.

In my opinion it looks great and I dont want to give it up.
But when player starts some dialog or changes scene, this screen shuts down and I have to show some static image as a scene bg and ofcourse it is not cosidering what "location" player had in that screen.

Here is some little gif showing what I mean:
https://drive.google.com/file/d/1ol1wxH ... sp=sharing

The whole code looks like this:

Code: Select all

screen ship_deck():

    zorder -1
    viewport id "ship_deck_sea_bg4":
        child_size 2021, 1080
        edgescroll (600, 1000, speed_scroll_sea4)
        add "ship_deck_sea_horizon_4" at wave_shaking4     

    viewport id "ship_deck_bg":
        side_xpos 0
        side_ypos 0
        child_size 3658, 1080
        edgescroll (600, 1000)

        add "ship_deck_screen"

        imagebutton:
            idle "ship_deck_hatch"
            hover "ship_deck_hatch hover"
            focus_mask True
            action Call("ship_deck_hatch")   


    viewport id "ship_deck_right_side":
        side_xpos 0
        side_ypos 0
        child_size 3658, 1080

        edgescroll (600, 1000, speed_scroll_right_side)
        add "ship_deck_right_side"
Personally I have only two ideas:
1. Get X coordinates of each displayed image on screen at the moment when you click on any imagebutton, then show some composite image as a background with displacement of each layer of an image for right amount of coordinates.
2. It's folly, but maybe I can make some picture of a screen in exact time when player clicks on imagebutton and this picture will be a background for the following dialogs and dissolves. Then it removes somehow from file storaging when it's no more needed.

There may already be a simple solution that I don't know... I really hope for any good ideas!

User avatar
Alex
Lemma-Class Veteran
Posts: 3090
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Viewport position

#2 Post by Alex »

BrotherKerubim wrote: Wed Jan 26, 2022 4:28 pm ...
1. Get X coordinates of each displayed image on screen at the moment when you click on any imagebutton, then show some composite image as a background with displacement of each layer of an image for right amount of coordinates....
You can store the values of viewports and use them later - viewtopic.php?f=8&t=58441#p526802

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Viewport position

#3 Post by Ocelot »

Sadly Issue 2920 prevents more clear and concise approach using 3D stages.
< < insert Rick Cook quote here > >

BrotherKerubim
Newbie
Posts: 11
Joined: Sun Oct 31, 2021 2:09 pm
Contact:

Re: Viewport position

#4 Post by BrotherKerubim »

Alex wrote: Thu Jan 27, 2022 3:34 pm
BrotherKerubim wrote: Wed Jan 26, 2022 4:28 pm ...
1. Get X coordinates of each displayed image on screen at the moment when you click on any imagebutton, then show some composite image as a background with displacement of each layer of an image for right amount of coordinates....
You can store the values of viewports and use them later - viewtopic.php?f=8&t=58441#p526802
Oh thanks, that was exactly the solution I needed. You are a lifesaver!

Post Reply

Who is online

Users browsing this forum: No registered users