Page 1 of 3

Scrolling Credits

Posted: Thu Jul 25, 2013 4:11 pm
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)

Re: Scrolling Credits

Posted: Fri Jul 26, 2013 10:25 am
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).

Re: Scrolling Credits

Posted: Fri Jul 26, 2013 1:07 pm
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

Re: Scrolling Credits

Posted: Mon Jul 29, 2013 11:16 am
by Sslaxx
Nice and simple, that!

Re: Scrolling Credits

Posted: Thu Nov 21, 2013 10:12 am
by Head_Phones
It's very helpful, thank you ^^

But how would you change the colour of the words?

Re: Scrolling Credits

Posted: Sat Nov 23, 2013 11:54 pm
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")

Re: Scrolling Credits

Posted: Fri Nov 29, 2013 12:32 pm
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()

Re: Scrolling Credits

Posted: Sun Oct 05, 2014 8:15 am
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'. ;)

Re: Scrolling Credits

Posted: Tue Oct 14, 2014 4:27 pm
by Cube
Is it possible to list more than one person for a task? (I'm referring to the credits = ('Backgrounds', 'Airgoof') thing.)

Re: Scrolling Credits

Posted: Tue Oct 14, 2014 4:58 pm
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

Re: Scrolling Credits

Posted: Sun Dec 18, 2016 4:18 pm
by crimsonnight
*EDIT* Solved! :)
Thanks again for the code though.

Re: Scrolling Credits

Posted: Thu Mar 16, 2017 5:13 pm
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?

Re: Scrolling Credits

Posted: Sat Jan 06, 2018 3:34 am
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.

Re: Scrolling Credits

Posted: Mon Jan 08, 2018 12:47 pm
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.

Re: Scrolling Credits

Posted: Thu Jan 18, 2018 1:48 am
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 :/