CREATE YOUR AI CUM SLUT ON CANDY.AI TRY FOR FREE
x

Ren'Py Help with timing "tranform" & looping

DarkLoki

Member
Game Developer
Oct 25, 2018
413
646
Hi-ho!
First I'd like to thank everyone for all their support. Back in the day, when I taught programming, I used to tell my students "Programming is like banging your head against the Wall because it feels great when you finish". That being said, I have an issue that apparently Google thinks I don't even know how to ask the correct question, so here it is.

I (with much help) have created a transform that will pan slowly up an image, like in Something Unlimited. Code works great:

Code:
transform panzoom:
    xalign 0.54
    yalign 1.0
    linear 12.0 yalign 0.0
and called by :
Code:
    show image001 at panzoom
ISSUE #1
I want to be able to scroll back down, but instead of a nice smooth pan, it ZOOMS back to the bottom of the image
Code:
transform panzoomback:
    xalign 12.0
    yalign 0.0
    linear 0.54 yalign 1.0
So my question is How do I slow it down so I can pan casually up, then casually down at the same pace?

Not looking for anyone to do my work for me , just looking to learn. Thanx in advance (again)

ISSUE #2
Not as important, but would love to learn. I wish to infinitely loop the whole thing. I have tried a gazillion variations of the JUMP statement, but I'm already in a LABEL and don't want to loop the whole label, just the show statements.
 

GamesMtP

Well-Known Member
Game Developer
Jul 2, 2017
1,274
3,382
I use this:

Code:
transform pan_view:
    yalign 0.0
    linear 10.0 yalign 1.0
    pause 0.1
    linear 10.0 yalign 0.0
    pause 0.1
    repeat
Sidenote: Are you using show throughout your game for fullscreen images?
 
  • Like
Reactions: gojira667

DarkLoki

Member
Game Developer
Oct 25, 2018
413
646
I use this:

Code:
transform pan_view:
    yalign 0.0
    linear 10.0 yalign 1.0
    pause 0.1
    linear 10.0 yalign 0.0
    pause 0.1
    repeat
Sidenote: Are you using show throughout your game for fullscreen images?
Thank you for the reply, I will try it.
Yes, I suppose I am using "show". I'm still fairly green to the vagaries and nuances of Renpy and Python. What do you suggest?
 

GamesMtP

Well-Known Member
Game Developer
Jul 2, 2017
1,274
3,382
Thank you for the reply, I will try it.
Yes, I suppose I am using "show". I'm still fairly green to the vagaries and nuances of Renpy and Python. What do you suggest?
The two common ways of showing images in ren'py are SCENE and SHOW. Scene is "meant" to set the background while show is "meant" to overlay the background with for example talking characters.

When you switch from scene to scene, all is fine, but when you show one image after another, it's put on top of whatever was there before. After a while, you get:
1728478144033.png
All the shown images are still under there. Eating resources. You can use the hide command to get rid of a shown image, but it's a lot clunkier than just using scene to begin with. Show is used for whatever is not fullscreen that overlays the current scene. Maybe UI elements or a phone thing.
 
  • Like
Reactions: DarkLoki

DarkLoki

Member
Game Developer
Oct 25, 2018
413
646
The two common ways of showing images in ren'py are SCENE and SHOW. Scene is "meant" to set the background while show is "meant" to overlay the background with for example talking characters.

When you switch from scene to scene, all is fine, but when you show one image after another, it's put on top of whatever was there before. After a while, you get:
View attachment 4114794
All the shown images are still under there. Eating resources. You can use the hide command to get rid of a shown image, but it's a lot clunkier than just using scene to begin with. Show is used for whatever is not fullscreen that overlays the current scene. Maybe UI elements or a phone thing.
Thanx again. I will try it!
 

Turning Tricks

Rendering Fantasies
Game Developer
Apr 9, 2022
1,355
2,523
Hi-ho!
First I'd like to thank everyone for all their support. Back in the day, when I taught programming, I used to tell my students "Programming is like banging your head against the Wall because it feels great when you finish". That being said, I have an issue that apparently Google thinks I don't even know how to ask the correct question, so here it is.

I (with much help) have created a transform that will pan slowly up an image, like in Something Unlimited. Code works great:

Code:
transform panzoom:
    xalign 0.54
    yalign 1.0
    linear 12.0 yalign 0.0
and called by :
Code:
    show image001 at panzoom
ISSUE #1
I want to be able to scroll back down, but instead of a nice smooth pan, it ZOOMS back to the bottom of the image
Code:
transform panzoomback:
    xalign 12.0
    yalign 0.0
    linear 0.54 yalign 1.0
So my question is How do I slow it down so I can pan casually up, then casually down at the same pace?

Not looking for anyone to do my work for me , just looking to learn. Thanx in advance (again)

ISSUE #2
Not as important, but would love to learn. I wish to infinitely loop the whole thing. I have tried a gazillion variations of the JUMP statement, but I'm already in a LABEL and don't want to loop the whole label, just the show statements.

Honestly, I got away from doing the slow pan shots because almost everyone just clicks through them (myself included, when I am playing another game!)

Instead, I use a custom screen to allow the player to scroll up or down, by using either the mouse wheel or clicking & dragging the image.

So you just call this screen as such...

call screen panning_screen("your_image_name_here")

Python:
screen panning_screen(image_name):
    modal True
    style_prefix "panning"

    viewport:
        draggable True
        mousewheel True
        add image_name

    text "Click & drag or use Mousewheel to scroll up or down (DONE to exit)"

    textbutton "DONE":
        style "panning_button"
        action [Hide("panning_screen", dissolve), Return()]

style panning_text:
    anchor (0.0, 1.0)
    pos (50, 1020)
    size 24
    ## add font and style formats here

style panning_button is button:
    anchor (1.0, 1.0)
    pos (1920-50, 1020)
    xsize 200
    top_padding 10
    bottom_padding 10
    ## set up for 1080p resolution

style panning_button_text is button_text:
    xalign 0.5
    ## add font and style formats here
 
  • Like
Reactions: DarkLoki

DarkLoki

Member
Game Developer
Oct 25, 2018
413
646
Honestly, I got away from doing the slow pan shots because almost everyone just clicks through them (myself included, when I am playing another game!)

Instead, I use a custom screen to allow the player to scroll up or down, by using either the mouse wheel or clicking & dragging the image.

So you just call this screen as such...

call screen panning_screen("your_image_name_here")

Python:
screen panning_screen(image_name):
    modal True
    style_prefix "panning"

    viewport:
        draggable True
        mousewheel True
        add image_name

    text "Click & drag or use Mousewheel to scroll up or down (DONE to exit)"

    textbutton "DONE":
        style "panning_button"
        action [Hide("panning_screen", dissolve), Return()]

style panning_text:
    anchor (0.0, 1.0)
    pos (50, 1020)
    size 24
    ## add font and style formats here

style panning_button is button:
    anchor (1.0, 1.0)
    pos (1920-50, 1020)
    xsize 200
    top_padding 10
    bottom_padding 10
    ## set up for 1080p resolution

style panning_button_text is button_text:
    xalign 0.5
    ## add font and style formats here
Thank you for the reply. Looks interesting, I'll take a look...
 

TDoddery

Member
Apr 28, 2020
175
168
ISSUE #1
I want to be able to scroll back down, but instead of a nice smooth pan, it ZOOMS back to the bottom of the image
The discussion has moved on, but just to address your first issue directly, I think it's because scrolling up you used:
"linear 12.00 yalign 0.0"
whereas for scrolling down you used:
" linear 0.54 yalign 1.0"

(the number after the word "linear" is the time it takes in seconds)
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,611
2,259
I wrote something a while ago but about transitions directly against scenes, rather creating the transform separately.
But it has some overlap with what you're trying to do.
Maybe it'll cover something that will help.
https://f95zone.to/threads/panning-an-image-up.45285/post-3000651

Otherwise, if you already know all that - no harm done, other than the time it takes to read it.

Simple version is that each transform line is where you want the image to end after a certain amount of time. The start is where ever the image is now (even if the image is already on the move).
Scrolling back will always return to where the image started, with no transition.
 
  • Like
Reactions: DarkLoki