For my own game i have tried to do the following when the game starts:
- a non-skipable logo intro and a skipable opening
- a "Press to Start" screen which jumps to the opening if not pressed after certain time (a repeating circle it left alone, basically)
Since i am a beginner, it took me a bit to figure everything out till i had it working the way i wanted, so i thought i might share (:
First of all we start with the non-skipable intro part and movie part.
1.) We start by preparing everything needed for those. For that we need to state all the images to be used in the intro. In this case, we will neeed:
Code: Select all
image black = "#000" #Black Background
image white = "#ffffff" #White Background
image logo = "logo.png" #Your Logo
For our Intro we will have (1) the screen change from black to white (2) afterwards fade the logo in and out (3) and have the screen change from white to black again.
For that we do the following:
Code: Select all
#Transformation for Logo
transform transform_logo:
on show:
alpha 0 xalign 0.5 yalign 0.5
linear 2.0 alpha 1
on hide:
linear 2.0 alpha 0
Each transformation (showing and hiding) takes 2 seconds. (Why knowing this is needed you will see in step 3)
Code: Select all
#Transformation for background
transform transform_white:
on show:
alpha 0
linear 2.0 alpha 1
on hide:
linear 2.0 alpha 0
When showing, its transparent and then takes 2 seconds to be completly visible. Hiding is the same, only reversed (fist completly visible and afterwards completly transparent)
Each transformation (showing and hiding) takes 2 seconds.
3.) For the movie part, we need to prepare nothing aside from having the movie in the game folder. Hence, we can start putting everything together.
For this we will use a splashscreen since, if exists, is labeled when the game first runs. We do this:
Code: Select all
label splashscreen:
scene black #We start with a black scene
$ renpy.pause(1, hard=True) #Pauses the black screen for a second. This command pauses renpy, hence makes it unable to click
show white at transform_white #next we swho our white screen with our made transformation
$ renpy.pause(2, hard=True) #For this its important to know the transformation time. Since the transformation is "happening" at the same time, the pause needs to be at least as long as the transformation. Otherwise it gets cut off.
show logo at transform_logo #Next, we are showing our logo with our logo transformation.
$ renpy.pause(6, hard=True) #Our logo takes 2 second to appear, however, we want it to stay on the screen for a while, hence we are using 6 instead of 2 seconds, so it stays for 4 seconds.
hide logo #Next we are hiding our logo
$ renpy.pause(2, hard=True) #Since the transformation is 2 seconds long, the pause here is 2 seconds long.
hide white #Next we are hiding our background.
$ renpy.pause(3, hard=True) # Our hiding transformation for the white bg takes 2 seconds, but since we want the screen to stay black for a second, like at the beginning, we use 3 instead.
$ renpy.movie_cutscene('opening.ogv') #Next we are showing our video. This one is skipable
return
5.) Next, we are doing our "Press to Start" screen with the ability to jump back to the opening when left unclicked for some time (Hence, back an forth between the "Press to Start" screen and opening when left alone.).
First, we are making an opening label with the opening to use when time runs out.
Code: Select all
label opening:
$ renpy.movie_cutscene('opening.ogv')
jump before_main_menu #This needs to be set to this as its a screen that appears before the main_menu and is the one we will use for our "Press to Start" screen.
6.) Next we start preparing the actual "Press to Start" screen.
First, we make a transformation which is blinking:
Code: Select all
transform transform_blink:
linear 1.0 alpha 0.2
linear 1.0 alpha 1.0
repeat
7.) Next we are making the press to start screen:
Make sure your images you want to use are in the game folder.
Code: Select all
screen press_to_start():
tag menu
add "background.png" #The background you wish to use.
add "press_to_start.png" xalign 0.5 yalign 0.5 at transform_blink #The "Press to Start" text. I am using an image for that. The image is displayed at the middle with our blinking transformation.
imagemap: #Next, we will want the whole screen to act as button, for that we are making an imagemap.
ground "transparent.png" #So that nothing gets "covered" we are making a transparent image that covers the whole screen and--
hotspot (0, 0,1920, 1080) focus_mask None action Show("main_menu", transition=dissolve) #set the hotspot to the whole screen. To make sure the transparent is clickable we set the focus_mask to None. When clicked it shows the main menu with dissolve.
timer 50 action Jump("opening") #when left alone for 50 seconds, it jumps to the opening label.
Code: Select all
label before_main_menu:
call screen press_to_start #Here, we are calling our already made "Press to Start" screen.
Now you should have a working none-skipable logo intro, an opening and a "Press to Start" screen which swiches to the opening if not used etc (:
So you dont have to copy paste it one by one, here is the whole code used in the tutorial summed up:
Code: Select all
##Intro with Opening
image black = "#000"
image white = "#ffffff"
image logo = "logo.png"
transform transform_logo:
on show:
alpha 0 xalign 0.5 yalign 0.5
linear 2.0 alpha 1
on hide:
linear 2.0 alpha 0
transform transform_white:
on show:
alpha 0
linear 2.0 alpha 1
on hide:
linear 2.0 alpha 0
label splashscreen:
scene black
$ renpy.pause(1, hard=True)
show white at transform_white
$ renpy.pause(2, hard=True)
show logo at transform_logo
$ renpy.pause(6, hard=True)
hide logo
$ renpy.pause(2, hard=True)
hide white
$ renpy.pause(3, hard=True)
$ renpy.movie_cutscene('opening.ogv')
return
## Press to Start Screen
label opening:
$ renpy.movie_cutscene('opening.ogv')
jump before_main_menu
transform transform_blink:
linear 1.0 alpha 0.2
linear 1.0 alpha 1.0
repeat
screen press_to_start():
tag menu
add "background.png"
add "press_to_start.png" xalign 0.5 yalign 0.5 at transform_blink
imagemap:
ground "transparent.png"
hotspot (0, 0,1920, 1080) focus_mask None action Show("main_menu", transition=dissolve)
timer 50 action Jump("opening")
label before_main_menu:
call screen press_to_start
Have a nice day! (: