Splashscreen animation help

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
Green Glasses Girl
Veteran
Posts: 367
Joined: Thu Jul 11, 2013 7:16 pm
Projects: Cavaliers & Carnivals
Tumblr: green-glasses
Contact:

Splashscreen animation help

#1 Post by Green Glasses Girl »

I'm returning to working out programing on my VN after awhile and I'm having some issues. What is the proper way of doing this so that the opening animation on the splashscreen of the main menu only plays once? My question was answered and now I'm attempted it: viewtopic.php?f=8&t=25516#p313426

I know the animation coding is supposed to go under "label splashscreen" in script.rpy, but I'm running into errors by simply moving the ATL coding from screens.rpy to script.rpy.

Script:

Code: Select all

# The game starts here.
    label splashscreen:
        
    image sparkle = SnowBlossom("ui/glow1.png", count=70, border=0, xspeed=(15, 20), yspeed=(5, 20), start=1.5, fast=True, horizontal=True) 
        
    transform logo_title:
        alpha 0.0 xpos 140
        pause 0.9
        alpha 0.1 
        pause 0.08
        alpha 0.2
        pause 0.08
        alpha 0.4
        pause 0.08
        alpha 0.6
        pause 0.08
        alpha 0.8
        pause 0.08
        alpha 1.0
        pause 0.5
        linear 0.8 ypos 120
        
            
    transform mm_navi:
        alpha 0.0 
        pause 2.5
        alpha 0.1 
        pause 0.1
        alpha 0.2
        pause 0.1
        alpha 0.4
        pause 0.1
        alpha 0.6
        pause 0.1
        alpha 0.8
        pause 0.1
        alpha 1.0
        pause 0.1

    return

label start:
        
Screens:

Code: Select all

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"
    
    #add "logo_blend"
    add "ui/logo.png" ypos 200 at logo_title
    #add "sparkle" at sparkle_enter
    add AlphaBlend("ui/logo.png", Frame(Null(), 10, 10), "sparkle", alpha=True) ypos 200 at logo_title
    
    imagebutton auto "ui/mm_start_%s.png" xpos 560 ypos 460 focus_mask True action Start() at mm_navi activate_sound "sound/magic_string_spell1.wav"
    imagebutton auto "ui/mm_load_%s.png" xpos 560 ypos 505 focus_mask True action ShowMenu("load") at mm_navi
    imagebutton auto "ui/mm_pref_%s.png" xpos 500 ypos 550 focus_mask True action ShowMenu("preferences") at mm_navi
    imagebutton auto "ui/mm_quit_%s.png" xpos 560 ypos 595 focus_mask True action Quit(confirm=False) at mm_nav
 
init -2 python:

    # Make all the main menu buttons be the same size.
    style.mm_button.size_group = "mm"
Last edited by Green Glasses Girl on Fri Apr 29, 2016 12:20 am, edited 2 times in total.
Image

Honest Critique
Avatar art by akemicchi.

philat
Eileen-Class Veteran
Posts: 1910
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Splashscreen animation help

#2 Post by philat »

Well, it's not very helpful if you don't list the error you're getting or the code you used in label splashscreen...?

User avatar
Green Glasses Girl
Veteran
Posts: 367
Joined: Thu Jul 11, 2013 7:16 pm
Projects: Cavaliers & Carnivals
Tumblr: green-glasses
Contact:

Re: Splashscreen animation help

#3 Post by Green Glasses Girl »

^Sorry, I was in the process of editing that post and then tooled around to fix the error. I just edited that post now to include the coding of both files.
Image

Honest Critique
Avatar art by akemicchi.

philat
Eileen-Class Veteran
Posts: 1910
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Splashscreen animation help

#4 Post by philat »

I don't know exactly what effect you're going for, but you shouldn't be declaring stuff in splashscreen.

Code: Select all

init:
    # declare images
    # declare transforms

label splashscreen:
    show declared_image at declared_transform
    pause 10 # use appropriate time (to match transform animation)
Get rid of the adds in your main menu screen if you don't want them to replay each time the main menu screen is shown.

User avatar
Green Glasses Girl
Veteran
Posts: 367
Joined: Thu Jul 11, 2013 7:16 pm
Projects: Cavaliers & Carnivals
Tumblr: green-glasses
Contact:

Re: Splashscreen animation help

#5 Post by Green Glasses Girl »

I want the background to appear followed by the logo (with sparkles) to slowly fade in and move up a little bit, followed by the navigation icons to slowly fade it right after it. Like this: https://youtu.be/zj4rKX5aK6M
The problem now after moving the code before label splashscreen is that the logo no longer appears, but there is still a pause of the animation's length each time you toggle between screens.

Script:

Code: Select all

     init:
        image logo_title_image = "ui/logo.png" 
        
    image sparkle:
        SnowBlossom("ui/glow1.png", count=65, border=0, xspeed=(15, 20), yspeed=(5, 20), start=2.0, fast=True, horizontal=True)

    image logo_blend = AlphaBlend("logo_title_image", Frame(Null(), 10, 10), "sparkle", alpha=True) 
    
    transform logo_title:
        alpha 0.0 xpos 140
        pause 0.9
        alpha 0.1 
        pause 0.08
        alpha 0.2
        pause 0.08
        alpha 0.4
        pause 0.08
        alpha 0.6
        pause 0.08
        alpha 0.8
        pause 0.08
        alpha 1.0
        pause 0.5
        linear 0.8 ypos 120
           
    transform mm_navi:
        alpha 0.0 
        pause 2.5
        alpha 0.1 
        pause 0.1
        alpha 0.2
        pause 0.1
        alpha 0.4
        pause 0.1
        alpha 0.6
        pause 0.1
        alpha 0.8
        pause 0.1
        alpha 1.0
        pause 0.1    
         
# The game starts here.
    label splashscreen:
    show logo_title_image at logo_title

    return

    label start:

 
Screens:

Code: Select all

screen main_menu:

    
    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"
   
    
    imagebutton auto "ui/mm_start_%s.png" xpos 560 ypos 460 focus_mask True action Start() at mm_navi activate_sound "sound/magic_string_spell1.wav"
    imagebutton auto "ui/mm_load_%s.png" xpos 560 ypos 505 focus_mask True action ShowMenu("load") at mm_navi
    imagebutton auto "ui/mm_pref_%s.png" xpos 500 ypos 550 focus_mask True action ShowMenu("preferences") at mm_navi
    imagebutton auto "ui/mm_quit_%s.png" xpos 560 ypos 595 focus_mask True action Quit(confirm=False) at mm_navi
    
Last edited by Green Glasses Girl on Fri Apr 29, 2016 8:45 pm, edited 1 time in total.
Image

Honest Critique
Avatar art by akemicchi.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Splashscreen animation help

#6 Post by xavimat »

(please, put your code in [ code ] tags and not in [ quote ] tags, because the latter lost indentation).

The problem here is that "show" doesn't actually puts the image on the screen:
The show statement does not cause an interaction to occur. For the image to actually be displayed to the user, a statement that causes an interaction (like the say, menu, pause, and with statements) must be run.
(from the doc: https://www.renpy.org/doc/html/displayi ... -statement
Probably a pause is what you need (or a "with None" statement)


Also, why the transforms are so complicated? You could use:

Code: Select all

transform appearing:
    alpha 0.0
    linear 1.0 alpha 1.0

transform appear_and_up:
    alpha 0.0 yoffset 200
    linear 1.0 alpha 1.0 yoffset 0
Instead of linear, you can use ease, easein, easeout and a lot more: https://www.renpy.org/doc/html/atl.html#warpers
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Green Glasses Girl
Veteran
Posts: 367
Joined: Thu Jul 11, 2013 7:16 pm
Projects: Cavaliers & Carnivals
Tumblr: green-glasses
Contact:

Re: Splashscreen animation help

#7 Post by Green Glasses Girl »

Thanks for helping me understand that I can simplify the animation! :lol: I don't know why I always do things the more difficult way...

I read what you had before the edit - and moved everything back to screens.rpy. I only want it to play once per startup, which is why I wanted to implement label splashscreen since I thought using persistent would only show the animation only on the first time you first open the game? I'm not sure. I recently put them on two different screens, but it doesn't seem to change anything. I think I'm missing something else.

Code: Select all

screen main_menu:

    
    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"
        
    if persistent.openedgame == True:
        use menu_static
    else:
        use menu_animation

screen menu_static:
    
    tag menu
    window:
        style "mm_root"
        
    #add "logo_blend"
    add "ui/logo.png" ypos 200 at logo_title
    #add "sparkle" at sparkle_enter
    add AlphaBlend("ui/logo.png", Frame(Null(), 10, 10), "sparkle", alpha=True) ypos 200 at logo_title
    
    imagebutton auto "ui/mm_start_%s.png" xpos 560 ypos 460 focus_mask True action Start() at mm_navi activate_sound "sound/magic_string_spell1.wav"
    imagebutton auto "ui/mm_load_%s.png" xpos 560 ypos 505 focus_mask True action ShowMenu("load") at mm_navi
    imagebutton auto "ui/mm_pref_%s.png" xpos 500 ypos 550 focus_mask True action ShowMenu("preferences") at mm_navi
    imagebutton auto "ui/mm_quit_%s.png" xpos 560 ypos 595 focus_mask True action Quit(confirm=False) at mm_navi
    
screen menu_animation: 
    tag menu
    window:
        style "mm_root"
        
        #add "logo_blend"
    add "ui/logo.png" ypos 200 at logo_title
    #add "sparkle" at sparkle_enter
    add AlphaBlend("ui/logo.png", Frame(Null(), 10, 10), "sparkle", alpha=True) ypos 200 at logo_title
    
    imagebutton auto "ui/mm_start_%s.png" xpos 560 ypos 460 focus_mask True action Start() at mm_navi activate_sound "sound/magic_string_spell1.wav"
    imagebutton auto "ui/mm_load_%s.png" xpos 560 ypos 505 focus_mask True action ShowMenu("load") at mm_navi
    imagebutton auto "ui/mm_pref_%s.png" xpos 500 ypos 550 focus_mask True action ShowMenu("preferences") at mm_navi
    imagebutton auto "ui/mm_quit_%s.png" xpos 560 ypos 595 focus_mask True action Quit(confirm=False) at mm_navi

init -2:
        
    image sparkle = SnowBlossom("ui/glow1.png", count=70, border=0, xspeed=(15, 20), yspeed=(5, 20), start=1.5, fast=True, horizontal=True) 

    transform logo_title:
        alpha 0.0 xpos 140
        linear 1.0 alpha 1.0 ypos 120

    transform mm_navi:
        alpha 0.0 
        pause 2.5
        easein 1.0 alpha 1.0
I guess if it's too much, I can always just leave the opening animation each time. It's kind of a minor inconvenience, but people don't spend too long on the menu screen anyway.
Image

Honest Critique
Avatar art by akemicchi.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Splashscreen animation help

#8 Post by xavimat »

Sorry my answer is late.

In your code, the persistent variable is never set to True.

Anyway, I think your initial idea with the splashscreen was better. Simply you needed a "pause 2" statement before the return:

Code: Select all

label splashscreen:
    show main_menu_background with dissolve    
    show logo_with_sparks at in_and_up
    pause 2
    return

transform in_and_up:
    align (.5, .3)
    alpha 0.0 yoffset 100
    linear 1.0 alpha 1.0
    linear 1.0 yoffset 0
    
# And you don't need the buttons in the splash screen, you can put a transition from the splash to the main menu with config (see options.rpy, it's already there)
init python:
    config.end_splash_transition = dissolve

# In the main menu, put the same images without animations. There will be a little glitch between the sparks in the splashscreen and the menu but, hopefully, the dissolve will hide that a little.
screen main_menu():
    tag menu
    add logo_with_sparks align (.5, .3)
    vbox:
        align (.5, .7)
        imagebutton ....  # don't need the xpos and ypos for every imagebutton, they are in a vbox
        imagebutton ....
        imagebutton ....
        imagebutton ....
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Alex