Book opening, closing, page turning effect (not working, or WIP)

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
JessicleCat
Newbie
Posts: 7
Joined: Sun Jan 19, 2020 4:48 am
Contact:

Book opening, closing, page turning effect (not working, or WIP)

#1 Post by JessicleCat » Tue Feb 18, 2020 6:53 pm

I'm working on something else I intend to give to the Cookbook/Public Domain, and it's coming along okay but I need some help (project files attached below).

Image

I'm displaying a book object with pre-defined text (so that many books could use this same code). It is supposed to do the following:

1. open as it drops in from the top of the screen (or close as it flies off the screen) --- mostly working
2. displays pre-defined text on two facing pages that change with buttons to go to the next or previous page --- working totally fine
3. uses an animated page flip graphic, which displays as the pages change --- sort of working
4. as the pages change - the displayed text should be hidden before the replacing page's text is revealed - and it should be hidden with either:
a. a transform that changes the xzoom, to squish its width as if it is turning with the page
b. an image dissolve that wipes across the screen as the page turns
5. the replacing text should be displayed using the same sort of transition.
4. & 5. --- not working at all. I have no idea... well I have some idea*

Currently, the code changes the displayed text INSTANTLY (then plays the page turn animation, which is kind of awkward) - I mean, that's how I coded it, so this is not unexpected. But I'm not sure how to reconfigure it to get a transition in there, or have new text appearing as the old text is being hidden, since it's currently set up to only display the current text and replace that display with the next text.

I don't know how to get any farther than this right now, but I'll keep working on it. I could really use some coding help. :(

*Update:
I think what I need is a third (or a third and fourth), transitional text that is blank " " until the page turns. I've thought it out like this:
Step 1. The two texts of the current pages are displayed on the screen, with a static book background, until the user clicks a next page or previous page button
Step 2. The page flip animation image begins, on a higher zorder than those texts.
Step 3. The transitional text (on a higher zorder than the paper graphics) becomes the text of the moving page, and moves to a position appropriate for that page.
Step 4. The page text on that side becomes the new text (but it is hidden by the paper, which will move and reveal it)
Step 5. The transitional text xzoom squishes until it reaches 0 (at this point the paper animation is at the midpoint)
(if I used two transitional texts - one for each side, then the current one would stop at this point, and the rest would be the other side's transitional text)
Step 6. The transitional text becomes the new text of the facing page.
Step 7. The transitional text unsquishes from xzoom 0 to xzoom 1 - moving and/or changing its xanchor to the facing page.
Step 8. The paper and transitional text cover over the old text of the facing page text.
Step 9. THEN the facing page text becomes the new facing page text -
Step 10. as the transition text and the page flip animation are hidden, and the transition text returns to blank " ".

Step 11. I figure out how to code any of the stuff I just said! :roll:

The project files are attached (updated since I originally posted):
Book Testing.zip
(updated)
(35.45 MiB) Downloaded 2 times
Last edited by JessicleCat on Wed Feb 19, 2020 7:41 pm, edited 5 times in total.

User avatar
gas
Miko-Class Veteran
Posts: 620
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Book opening, closing, page turning effect (not working)

#2 Post by gas » Tue Feb 18, 2020 9:09 pm

You should use a function that trigger the animation, the animation that receive the computed parameter from the function, and the Function action.

I'm quite sure reading this will help you.
viewtopic.php?t=32305#p372483
10 ? "RENPY"
20 GOTO 10

RUN

User avatar
JessicleCat
Newbie
Posts: 7
Joined: Sun Jan 19, 2020 4:48 am
Contact:

Re: Book opening, closing, page turning effect (not working)

#3 Post by JessicleCat » Wed Feb 19, 2020 2:05 am

Thanks for the suggestion. I've been looking into it, but I haven't been able to figure out how, where, or when to implement it. I've polished up my code since my original post, and things are working a little better, but...

For the moment at least, I'm really hitting the wall. :?

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

Re: Book opening, closing, page turning effect (not working)

#4 Post by Alex » Wed Feb 19, 2020 3:05 pm

Have you seen this - viewtopic.php?f=51&t=54321 (might help some)?

User avatar
JessicleCat
Newbie
Posts: 7
Joined: Sun Jan 19, 2020 4:48 am
Contact:

Re: Book opening, closing, page turning effect (not working)

#5 Post by JessicleCat » Wed Feb 19, 2020 7:24 pm

I hadn't seen that (and I've searched so much!) but that's very close to what I'm trying to do! Andredron does lots of interesting stuff. I'll see if I can work with it.

Post Reply

Who is online

Users browsing this forum: Adrian_DVL, Bing [Bot], Google [Bot], ShadoStalk3r