Transitions independent from clicking

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
KELPER
Regular
Posts: 47
Joined: Wed Jun 05, 2013 3:31 am
Contact:

Transitions independent from clicking

#1 Post by KELPER » Mon Jul 01, 2013 6:09 am

Hello :D. I need to make a background that changes overtime, with a transition. Im doing it like this:

Code: Select all

image backgroundchange = anim.TransitionAnimation(
        im.Scale("back/background1", 800, 600), 8.0, dissolve,
        im.Scale("back/background2", 800, 600))
For some reason this is making my game to crash. Any idea why?

Thanks :)

pwisaguacate
Veteran
Posts: 356
Joined: Mon Mar 11, 2013 11:03 pm
Contact:

Re: Transitions independent from clicking

#2 Post by pwisaguacate » Mon Jul 01, 2013 6:31 am

Both filename extension and some parentheses are missing:

Code: Select all

image backgroundchange = anim.TransitionAnimation(
        (im.Scale("back/background1.png", 800, 600)),
        1.0, dissolve,
        (im.Scale("back/background2.png", 800, 600))
        )

KELPER
Regular
Posts: 47
Joined: Wed Jun 05, 2013 3:31 am
Contact:

Re: Transitions independent from clicking

#3 Post by KELPER » Mon Jul 01, 2013 7:06 am

Thanks you! I try adding the parenthesis (the extension was in the actual code, I just didnt write it here to be quick, sorry :) )

KELPER
Regular
Posts: 47
Joined: Wed Jun 05, 2013 3:31 am
Contact:

Re: Transitions independent from clicking

#4 Post by KELPER » Mon Jul 01, 2013 7:14 am

Thanks again :) , It worked, now it doesnt crash. But , there is another problem. For some reason is not taking the pause between backgrounds. Im doing it like this:

Code: Select all

image backgroundchange = anim.TransitionAnimation(
        (im.Scale("back/background1.png", 800, 600)),
        8.0, dissolve,
        (im.Scale("back/background2.png", 800, 600))
        )
        show backgroundchange with None
        
edit: By the way, what I want is not to show the first background wait 8 secs and dissolve quickly into the other background. What I want is an 8 secs dissolve :). But when I write this:

Code: Select all

image backgroundchange = anim.TransitionAnimation(
        (im.Scale("back/background1.png", 800, 600)), Dissolve(8.0),
        (im.Scale("back/background2.png", 800, 600))
        )
It crashes with the same error as before: TypeError: unsupported operand type(s) for +: 'int' and 'Curry'

pwisaguacate
Veteran
Posts: 356
Joined: Mon Mar 11, 2013 11:03 pm
Contact:

Re: Transitions independent from clicking

#5 Post by pwisaguacate » Mon Jul 01, 2013 8:27 am

Declare both images:

Code: Select all

image background1 = "back/background1.png"
image background2 = "back/background2.png"
Then use either one of these:
  • Code: Select all

    transform tobackground2:
        "back/background2.png" with Dissolve(8)
    
    start:
        show background1 at tobackground2
    
    (A transform allows you to reuse an animation sequence without rewriting the ATL block again.)
  • Code: Select all

    start:
        show background1:
            "background2" with Dissolve(8)
    
The background will dissolve slowly without being interrupted by user clicks.

KELPER
Regular
Posts: 47
Joined: Wed Jun 05, 2013 3:31 am
Contact:

Re: Transitions independent from clicking

#6 Post by KELPER » Mon Jul 01, 2013 8:32 am

Would that work with renpy 6.9?

edit: Ok, I solved it with your first advice and using Scene statement after rather than show.
Dont ask me why that solve it though. It seems that "show" left the animated image in the last state (the second background, or in the middle of the transition) when you rolled back with the mouse wheel and then tried to go back to show the animated background again. Scene doesnt allow for that.

Post Reply

Who is online

Users browsing this forum: _ticlock_