Scrolling Credits

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.
Message
Author
User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Scrolling Credits

#1 Post by leon »

This creates a fancy scrolling text effect, great for credits roll. The credit goes to DaFool who originally shared this code.

Code: Select all

label start:
    # A very short horror story...
    "The last man on Earth was sitting in a room alone."
    "There was a knock on the door."
    call credits
    return

label credits:
    $ credits_speed = 25 #scrolling speed in seconds
    scene black #replace this with a fancy background
    with dissolve
    show theend:
        yanchor 0.5 ypos 0.5
        xanchor 0.5 xpos 0.5
    with dissolve
    with Pause(3)
    hide theend
    show cred at Move((0.5, 5.0), (0.5, 0.0), credits_speed, repeat=False, bounce=False, xanchor="center", yanchor="bottom")
    with Pause(credits_speed)
    show thanks:
        yanchor 0.5 ypos 0.5
        xanchor 0.5 xpos 0.5
    with dissolve
    with Pause(3)
    hide thanks
    return

init python:
    credits = ('Backgrounds', 'Airgoof'), ('Backgrounds', 'Dorktwerp'), ('Sprites and CG', 'Ballclown'), ('GUI', 'Cuddlywad'), ('Writing', 'Dorktwerp'), ('Writing', 'Fingerpookie'), ('Programming', 'Dorktwerp'), ('Music', 'Grumblemuck'), ('Music', 'Headwookum')
    credits_s = "{size=80}Credits\n\n"
    c1 = ''
    for c in credits:
        if not c1==c[0]:
            credits_s += "\n{size=40}" + c[0] + "\n"
        credits_s += "{size=60}" + c[1] + "\n"
        c1=c[0]
    credits_s += "\n{size=40}Engine\n{size=60}Ren'py\n6.15.7.374" #Don't forget to set this to your Ren'py version
    
init:
#    image cred = Text(credits_s, font="myfont.ttf", text_align=0.5) #use this if you want to use special fonts
    image cred = Text(credits_s, text_align=0.5)
    image theend = Text("{size=80}The end", text_align=0.5)
    image thanks = Text("{size=80}Thanks for Playing!", text_align=0.5)

User avatar
Sslaxx
Regular
Posts: 52
Joined: Thu Jul 18, 2013 7:35 pm
Deviantart: sslaxx
Github: Sslaxx
Skype: Sslaxx
Location: Malvern, UK
Discord: Sslaxx#0159
Contact:

Re: Scrolling Credits

#2 Post by Sslaxx »

Do "credits" and "credits_s" need to be in the init python block?

EDIT: To answer my own question, yes they do. The "images" though don't seem to need to be in an init block, however. And I'm wondering if there's an easier way to deal with the Ren'Py version number - thought there was a variable somewhere that holds that information? Dunno if it's possible without having to build the game for distribution, though, and it doesn't seem to be absolute (more for backwards compatibility purposes than anything else).
Stuart "Sslaxx" Moore.

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Scrolling Credits

#3 Post by leon »

Sslaxx wrote:And I'm wondering if there's an easier way to deal with the Ren'Py version number - thought there was a variable somewhere that holds that information? Dunno if it's possible without having to build the game for distribution, though, and it doesn't seem to be absolute (more for backwards compatibility purposes than anything else).
I was wondering about the same thing. Yeah there's probably(?) a way to read the Ren'Py version number somehow. If anyone knows how, a fix to the code would be appreciated. It's a bit of an overkill, but programmers are lazy like that. :P And it would be one less thing to worry about when building a new distribution.

Edit: Got the answer from DragoonHP.
Replace this line:

Code: Select all

    credits_s += "\n{size=40}Engine\n{size=60}Ren'py\n6.15.7.374" #Don't forget to set this to your Ren'py version
with:

Code: Select all

    credits_s += "\n{size=40}Engine\n{size=60}" + renpy.version() #Nevermind. It's all good. :P

User avatar
Sslaxx
Regular
Posts: 52
Joined: Thu Jul 18, 2013 7:35 pm
Deviantart: sslaxx
Github: Sslaxx
Skype: Sslaxx
Location: Malvern, UK
Discord: Sslaxx#0159
Contact:

Re: Scrolling Credits

#4 Post by Sslaxx »

Nice and simple, that!
Stuart "Sslaxx" Moore.

User avatar
Head_Phones
Regular
Posts: 65
Joined: Sun Oct 27, 2013 11:02 am
Projects: Clichéd
Location: Singapore
Contact:

Re: Scrolling Credits

#5 Post by Head_Phones »

It's very helpful, thank you ^^

But how would you change the colour of the words?
'You may be a cunning linguist, but I am a master debater'
~Austin Powers



Profile pic drawn by the wonderful akemicchi

|| Honest Critique ||

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Scrolling Credits

#6 Post by leon »

To change the color, just add the color parameter (see text style properties).

Code: Select all

image cred = Text(credits_s, text_align=0.5, color="#00ff00")

User avatar
rabcor
Regular
Posts: 81
Joined: Sun Mar 17, 2013 3:07 pm
Projects: None (Need a programmer?)
Organization: Cestarian Games
Contact:

Re: Scrolling Credits

#7 Post by rabcor »

If anyone's interested, i modified this a little (the text will show right after "the end" and there are some effect improvements too.) it's really just an ugly hack that extends the time of the "The End" screen to make up for the duration the text doesn't show up for the most part, but i also added a few missing dissolve effects.

I'm wondering about a cleaner way to make the scrolling text show up faster though and not making it start off-screen... hmm... but this'll do for now i guess.

Code: Select all

label credits:
    image splash = Text("{size=90}Company Name", text_align=0.5, ypos=0.5) #Placeholder code if you don't have anything to use as a splash image or are just pure lazy.
#    image splash = "images/Company-Logo.png" #This is usually going to be located in an init block executed early in the code to show it when the game loads up as a splash screen.
#    image cred = Text(credits_s, font="myfont.ttf", text_align=0.5) #use this if you want to use special fonts
    image cred = Text(credits_s, text_align=0.5)
    image theend = Text("{size=80}The End", text_align=0.5)
    image thanks = Text("{size=80}Thanks for Playing!", text_align=0.5)
    $ credits_speed = 25 #scrolling speed in seconds
    scene black #replace this with a fancy background
    show cred at Move((0.5, 5.0), (0.5, 0.0), credits_speed, repeat=False, bounce=False, xanchor="center", yanchor="bottom")
    show theend:
        yanchor 0.5 ypos 0.5
        xanchor 0.5 xpos 0.5
    with dissolve
    with Pause(5)
    hide theend
    with dissolve
    with Pause(credits_speed - 5)
    show splash
    with dissolve
    with Pause(3)
    hide splash
    with dissolve
    with Pause(1)
    show thanks:
        yanchor 0.5 ypos 0.5
        xanchor 0.5 xpos 0.5
    with dissolve
    with Pause(4)
    hide thanks
    with dissolve
    return

init python:
    credits = ('Backgrounds', 'Airgoof'), ('Backgrounds', 'Dorktwerp'), ('Sprites and CG', 'Ballclown'), ('GUI', 'Cuddlywad'), ('Writing', 'Dorktwerp'), ('Writing', 'Fingerpookie'), ('Programming', 'Dorktwerp'), ('Music', 'Grumblemuck'), ('Music', 'Headwookum')
    credits_s = "{size=80}Game Title or Logo\n\n"
    c1 = ''
    for c in credits:
        if not c1==c[0]:
            credits_s += "\n{size=60}" + c[0] + "\n"
        credits_s += "{size=40}" + c[1] + "\n"
        c1=c[0]
    credits_s += "\n{size=60}Engine\n{size=40}" + renpy.version()

User avatar
Karl_C
Veteran
Posts: 232
Joined: Sun Mar 31, 2013 6:18 am
Contact:

Re: Scrolling Credits

#8 Post by Karl_C »

rabcor wrote:I'm wondering about a cleaner way to make the scrolling text show up faster though and not making it start off-screen... hmm... but this'll do for now i guess.
Sorry for late reply (maybe this is useful for others):

Delete 'persistent data' and the scrolling text will show up properly and won't start 'off-screen'. ;)

User avatar
Cube
Regular
Posts: 84
Joined: Tue Jul 08, 2014 1:00 pm
Completed: You and Me | Love is in Bloom
Projects: Ego Holic
Tumblr: qbstudios
itch: qbstudios
Contact:

Re: Scrolling Credits

#9 Post by Cube »

Is it possible to list more than one person for a task? (I'm referring to the credits = ('Backgrounds', 'Airgoof') thing.)

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: Scrolling Credits

#10 Post by leon »

Just list them like in the example.

Code: Select all

    credits = ('Backgrounds', 'Airgoof'), ('Backgrounds', 'Dorktwerp'), ...
Tasks will be grouped automatically like this:
Backgrounds
Airgoof
Dorktwerp

crimsonnight
Veteran
Posts: 298
Joined: Fri Apr 20, 2012 4:44 am
Contact:

Re: Scrolling Credits

#11 Post by crimsonnight »

*EDIT* Solved! :)
Thanks again for the code though.
alwaysthesamebluesky.com

User avatar
Ertal77
Veteran
Posts: 322
Joined: Sat Feb 27, 2016 2:33 pm
Completed: A Hand in the Darkness, Chasing the Stars, My Burning Heart, Blood and Lust, Lurkers, Jolly Roger, The Remainder, The Manor, Night and Day
Projects: Deep in the Forest and Exes Assault!!
Organization: Ertal Games
Tumblr: ertalgames
itch: ertal-games
Location: Spain
Discord: Ertal#0394
Contact:

Re: Scrolling Credits

#12 Post by Ertal77 »

Karl_C wrote:
rabcor wrote:I'm wondering about a cleaner way to make the scrolling text show up faster though and not making it start off-screen... hmm... but this'll do for now i guess.
Delete 'persistent data' and the scrolling text will show up properly and won't start 'off-screen'. ;)
I have the same problem, and it hasn't solved by deleting the 'persistent data' :cry:

The strange thing is that when I first added the credits, with just the basic people on it, it showed perfectly! Why it doesn't now? Any ideas?
Do you like BL games? Then join Ertal Games' Discord!

Blake337
Newbie
Posts: 24
Joined: Fri Sep 25, 2015 6:37 am
Skype: blake_mj
Contact:

Re: Scrolling Credits

#13 Post by Blake337 »

Sorry for the necro, but is there a way to make the credits unskippable? I find myself pressing enter before they even start and the game just instantly ends.
Ertal77 wrote: Thu Mar 16, 2017 5:13 pm
Karl_C wrote:
rabcor wrote:I'm wondering about a cleaner way to make the scrolling text show up faster though and not making it start off-screen... hmm... but this'll do for now i guess.
Delete 'persistent data' and the scrolling text will show up properly and won't start 'off-screen'. ;)
I have the same problem, and it hasn't solved by deleting the 'persistent data' :cry:

The strange thing is that when I first added the credits, with just the basic people on it, it showed perfectly! Why it doesn't now? Any ideas?
As for this, you should look at the line:

Code: Select all

show cred at Move((0.5, x.0), (0.5, 0.0), credits_speed, repeat=False, bounce=False, xanchor="center", yanchor="bottom")
The original post had a 5 where that x is. The longer your credits are, the higher that x will have to be. Basically, that x determines where on the y-axis your credits block will begin, so if they're too long and the x is too short, they will start inside the screen.

For my credits, I had to set it to 8. The higher the number, the longer they will take to start showing up.

User avatar
Ertal77
Veteran
Posts: 322
Joined: Sat Feb 27, 2016 2:33 pm
Completed: A Hand in the Darkness, Chasing the Stars, My Burning Heart, Blood and Lust, Lurkers, Jolly Roger, The Remainder, The Manor, Night and Day
Projects: Deep in the Forest and Exes Assault!!
Organization: Ertal Games
Tumblr: ertalgames
itch: ertal-games
Location: Spain
Discord: Ertal#0394
Contact:

Re: Scrolling Credits

#14 Post by Ertal77 »

Thank you for the reply! As you see, my question was posted almost one year ago XDD I solved with a little prodding and testing and a bit of help from the Discord channel. But it's cool to keep a written solution here, so people who come with a problem can find their answer.
Do you like BL games? Then join Ertal Games' Discord!

Blake337
Newbie
Posts: 24
Joined: Fri Sep 25, 2015 6:37 am
Skype: blake_mj
Contact:

Re: Scrolling Credits

#15 Post by Blake337 »

Ertal77 wrote: Mon Jan 08, 2018 12:47 pm Thank you for the reply! As you see, my question was posted almost one year ago XDD I solved with a little prodding and testing and a bit of help from the Discord channel. But it's cool to keep a written solution here, so people who come with a problem can find their answer.
Yeah I figured, but it doesn't hurt to leave it there.

Also, do you know a way to make the credits unskippable? Because as it is now, clicking will send you directly to the title screen :/

Post Reply

Who is online

Users browsing this forum: No registered users