Hello, in this video, we're going to be implementing the splash scene. So this last scene until now we've just got a essentially a bare bones scene, and we need to actually add an image that appears initially we need to, after a few seconds make a switch to a particular scene, which will for us be the main menu thing. To do this right simple, we go to the header file, we need to create a private method which is going to be private. And this is going to be void. Switch to Main Menu, they can guess what you're going to do, flow DT and DT stands for delta time. This is just going to be used for the scheduling of this method because it's going to be run after X amount of seconds have passed and we'll be able to determine how many seconds we want so you can easily change if you want it to be if you want these blasts into PR longer.
Or for less time, you can easily do that. So save that go to the cpp file. And in the cpp file, we need to include a file called include definitions dot h, I can no longer name definition just all definitions dot h. And we need to create that for now. So if you just add it as you normally would to your text editor or ID very simple stuff. And this is going to be code I need to add it to the targets can't forget to do that needs to be Daffy missions. And in here, what we are essentially going to put is the background foil path and how long we want to be Splash seem to show and a transition time as long as we're going to use their built in cohorts transition.
So if we get rid of their hash pragma once you do hash define blush underscore seen from the school background underscore file path. And this essentially will be this path right here. So it will be rest forward slash. And we want these flash background flash background dot png we need to do hash defines for how long we want this flash scene to show so it's gonna be slash underscore scene underscore show underscore time and for this, I'm going to put 2.0 seconds So 2.0 and now we need a define for the scene transition time. So for this upper 0.2, we can modify the accordingly. So if we go to our flash scene dot cpp in here, what we want to do is scroll down inside the init method.
After we've signed into Game Center, we're going to use the CO cos helper, which is fantastic because we don't actually have to create. sprites are still going to be using sprites in different scenes. But for stuff like background work, which is centered and it's always static, we can easily use the Coco's helper built in methods to position it really, really easy, easily, just dishonor Coco's helper, UI colon colon, ad, set scented background, and you first specify the background paths for that will be splashed on the source screen on a score background file path. And then you specify the layer, which is what you want to add it to. And when you specify something like that, in some sort of drawing method, you just put this. Now you want to do schedule.
Once, we're going to schedule that switch to Main Menu method only once because we'll be on a splash screen, and then we won't be so we only need to call it once is the schedule underscore selector. And inside here, we'll put the class name, which is the current class that we're in Colin Colin switch to Main Menu, we're not passing in any parameter because that's all handled by the schedule once per comma, and then the splash time, or how long we want it to show for because this method is going to be caught after X amount of seconds. So this is essentially how long we wanted to show for. And now we need to implement the switch to Main Menu methods. To do that very, very simple, just caught void slash, scene, switch to Main Menu, loads dt. And in here we're going to put a scene.
So we need to create an instance of the scene that we want to switch to, which is, I think, you guessed it, the main menu scene which we actually need to include up top, the asset for the hash include, name, the scene, scroll down, you just got Main Menu, scene, colon, colon, create scene. And now we go to create a transition that we're going to use for switching between the scenes. And we're going to be using the transition state. There are a whole heap of trends Russians, if you check out our Comcast API API guide, there will be a link available to that we have all of the different transitions listed on there, along with images and videos to show you what they essentially do, and all the code that you need to implement it. So we're going to call it transition, very creative as you can tell, equal to transition, fade, colon, colon create only one parameter Daddy, actually, I mean, two parameters they takes technically, we're not going to be using the color value.
We're going to be using scene, which is the scene that we want to switch to. And the amount of time we want the transition to laugh. And this is going to be scene transition time. The last line of code that we need to call is Director, colon, colon get instance. So again, an instance of the direct exam, there's only one instance ever they exist in COPPA to dx We're going to replace scene which essentially gets rid of the currency with a nother scene. So it pops off the scene and pushes on another scene onto the stack, transition.
Transition fade transition, what we created transition right here, or semi colon, we are now ready to run this awesome application run it is just building a link in it. And hopefully it's all going to be successful using this for a moment with is it going to work or not? It's going to deploy it now. We have our slack team say sonar games, which is just our sonar game division logo. And as you can see, after X amount of seconds, it went to this particular scene. So it's that simple.
Once we've added some images and some buttons on to the main menu We'll look a lot better. And we'll be doing that in the next video. If you have any questions, feel free to post them on my education platform. So na learning.co.uk and if you check out the source code, feel free there will be a GitHub link available. And as usual, thanks for watching and I hope you have a great day.