Hello, welcome to the 17th tutorial on the Coco's to the Flappy Bird c++ series. And in this part we're gonna be looking at adding audio we'll be continuing on from the previous part of this tutorial series. If you don't have it, don't worry, there'll be a link in the description to the source code. Okay, the game plays well performed live functionality but lacks sound, the sound falls already added in our Resources folder, so if we just right click this and show in Finder, we have our sound folder here we freeze and hit point. And wink, I was going to drag and drop this has made sure it is added only one tip added as a reference. And it's an iMac target why now we have been so far.
And now we can click Finish. And now we can actually access these files. Obviously on Android you don't need to actually add it anywhere like this. You just need to make sure it's in the right folder. This is actually the last tutorial on doing any sort of code for this class, because we are going to have one more part of the series, where described a little bit later on at the, at the end of this tutorial, what that is going to be. So let's get into this for we actually plan it and the first we will preload the audio in the splicing, the code will be added before any code in the init method but after the layer statement check aka after this.
So we're going to do cos denture. The reason have to code extension is the that the audio engine is then built into Coco's to the x. Or I mean what that is, I haven't added any particular files. It's all included when you download it and set it up but it's actually external library. So you could in theory, add all the audio libraries if you wanted something like f mod for example, Simple Audio engine get instant Don't do pre load effect. And for this we're just going to specify for slash hit dot mp3 and this hit done before we played we play the edge or you can copy and paste this change hit two point this will be when you go in between pipes and score a point and the final one is a wing which will be triggered when you click on the screen and make your bird fly MP free.
Okay the first step and we will play in making a bird fly this will be added at start in the fly method in the bird class. So, right the other Sonia just Mondo Fly here. This is the one right here. It's got a bit tight because it's an inline method, but it's not too much of an issue of death. So I was going to do class tension Simple Audio engine. Yeah.
Instance delay for waiting for IntelliSense to pop up and then Sam for slash wing, but MP free. And now the second time effect we will play is when the player and the point aka goes through the pipe. This will be added in the games in class where collision detection is done. So if we go to a game scene dot cpp and here will just be added right here. This is where we detect if we score a point. So I'm going to focus attention Simple Audio engine get instant delay effect.
And for this we're gonna put sounds for slash not wing point dot mp3. The final sound effect we will play is when the player dies aka to the point or the edge which will be played in 30 games in class where the collision detection is down. So basically here we're gonna do Chromecast engine, extension, Simple Audio engine, get instance, fly. If you can hear some sort of weird noise somebody next door is basically doing some sort of sorting and drilling. So that would be that if you can hear but you might be able to, for us explain what it is. So let's just run this now.
Make sure the sound is on full so you can hear Okay, take play you get the sound perfect. And then let's just crash and then let's also just crash on the floor could be crushed on a pipe then we got the same time effect and as you can see this is actually part of this tutorial, but we've got the score from the previous part of this series that will be which was for took that is it for this tutorial and in many ways this series because the next tutorial will literally just be me talking about extra tasks that you can do because game is done now. Give you a few extra Some of them to make it a bit more like the original Flappy Bird, and some just extra tasks to make the game even better. So, thanks for watching. I hope you have a nice day.
If you need to message us you can message us at support at sound systems coda UK. The email will be in the description you can comment on this video which was directly messages via YouTube, or the recording for source code will also be in the description and bye