Leafing through the pages of the book

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
Andredron
Veteran
Posts: 421
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Leafing through the pages of the book

#1 Post by Andredron » Thu Mar 14, 2019 2:35 pm

Image

Code: Select all


###by 7dots Ruslan Nebykov
init -1 python:
    # game window in the center of the screen
    import os
    os.environ ['SDL_VIDEO_CENTERED'] = '1'
    # automatic image ads
    config.automatic_images_minimum_components = 1
    config.automatic_images = ['', '_', '/']
    config.automatic_images_strip = ['images']
    style.default.font = "fonts / AnimeAceV3.ttf"
    style.default.size = 22

init:
    # position of the left page
    transform lf ():
        xpos .5 xanchor 1.0 yalign .5
    # position of the right page
    transform rg ():
        xpos .5 xanchor 0.0 yalign .5
    # right to center (scrolling right to center)
    transform r2c (delay = .25):
        xpos .5 xanchor 0.0 xzoom 1.0 yalign .5
        easeout delay xzoom 0.001
    # center to left (scrolling from the center to the left)
    transform c2l (delay = .25):
        xpos .5 xanchor 1.0 xzoom .001 yalign .5
        easein delay xzoom 1.0
init python:
    # flipping
    # first new pages, then old
    # if the page is not specified, it will be empty
    def pflip (new1 = "pageleft", new2 = "pageright", old1 = "pageleft", old2 = "pageright", delay = .5):
        renpy.hide ("pleft")
        renpy.hide ("pright")
        renpy.show (old1, [lf ()], tag = "pleft")
        renpy.show (new2, [rg ()], tag = "pright")
        renpy.show (old2, [r2c (delay * .5)], tag = "plist")
        renpy.pause (delay * .5)
        renpy.show (new1, [c2l (delay * .5)], tag = "plist")
        renpy.pause (delay * .5)
        renpy.show (new1, [lf ()], tag = "pleft")
        renpy.show (new2, [rg ()], tag = "pright")
        renpy.hide ("plist")

label start:
    scene expression "# 445"
    show pagebook with dissolve
    "Now look through the book. Just click on the screen."
    # from blank to title
    $ pflip ("page0", "page1")
    pause
    # title to text
    $ pflip ("page2", "page3", "page0", "page1")
    pause
    # go back to empty pages
    $ pflip (old1 = "page2", old2 = "page3")
    "The remaining pages are empty for some reason."
    # from empty to empty
    $ pflip ()
    "Well, there is no point flipping further."
    # remove pages from the screen and the book itself
    hide pleft
    hide pright
    hide pagebook
    with dissolve
    return
Download http://renpyfordummies.blogspot.com/201 ... t.html?m=1


2) Menu in the form of an animation of a page

Image

Download - http://renpyfordummies.blogspot.com/201 ... 5.html?m=1
I know, I'm writing terribly in English.

I'm writing a Renpy textbook (in Russian). https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

Honest Critique

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Leafing through the pages of the book

#2 Post by isobellesophia » Fri Mar 15, 2019 2:58 am

Thank you Andredron!

But is this also use as a book novel? Instead of a default one?
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Andredron
Veteran
Posts: 421
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Leafing through the pages of the book

#3 Post by Andredron » Fri Mar 15, 2019 4:20 am

isobellesophia wrote:
Fri Mar 15, 2019 2:58 am
Thank you Andredron!

But is this also use as a book novel? Instead of a default one?
Yes it is true, it will be especially important to look if you are doing a project in the form of a notebook, a children's story. Or a comic book presentation where you buy chapters
I know, I'm writing terribly in English.

I'm writing a Renpy textbook (in Russian). https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

Honest Critique

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Leafing through the pages of the book

#4 Post by isobellesophia » Fri Mar 15, 2019 4:42 am

I see, i will try!
I am a friendly user, please respect and have a good day.


Image

Image


Post Reply

Who is online

Users browsing this forum: Hseo, MenmaYu