Implementing The Game Over Scene

9 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€65.26
List Price:  €93.23
You save:  €27.97
£55.95
List Price:  £79.94
You save:  £23.98
CA$95.75
List Price:  CA$136.79
You save:  CA$41.04
A$107.23
List Price:  A$153.20
You save:  A$45.96
S$95.15
List Price:  S$135.94
You save:  S$40.78
HK$547.94
List Price:  HK$782.80
You save:  HK$234.86
CHF 63.91
List Price:  CHF 91.30
You save:  CHF 27.39
NOK kr766.40
List Price:  NOK kr1,094.90
You save:  NOK kr328.50
DKK kr486.75
List Price:  DKK kr695.39
You save:  DKK kr208.64
NZ$117.46
List Price:  NZ$167.81
You save:  NZ$50.35
د.إ257.06
List Price:  د.إ367.25
You save:  د.إ110.18
৳7,670.29
List Price:  ৳10,958.03
You save:  ৳3,287.74
₹5,832.01
List Price:  ₹8,331.80
You save:  ₹2,499.79
RM334.37
List Price:  RM477.70
You save:  RM143.32
₦88,678.72
List Price:  ₦126,689.32
You save:  ₦38,010.60
₨19,457.85
List Price:  ₨27,798.13
You save:  ₨8,340.27
฿2,591.43
List Price:  ฿3,702.20
You save:  ฿1,110.77
₺2,274.88
List Price:  ₺3,249.97
You save:  ₺975.09
B$360.25
List Price:  B$514.66
You save:  B$154.41
R1,330.75
List Price:  R1,901.16
You save:  R570.40
Лв127.68
List Price:  Лв182.41
You save:  Лв54.73
₩96,191.02
List Price:  ₩137,421.64
You save:  ₩41,230.61
₪265.67
List Price:  ₪379.55
You save:  ₪113.87
₱4,044.82
List Price:  ₱5,778.57
You save:  ₱1,733.74
¥10,886.62
List Price:  ¥15,552.99
You save:  ¥4,666.36
MX$1,193.70
List Price:  MX$1,705.36
You save:  MX$511.66
QR254.90
List Price:  QR364.16
You save:  QR109.26
P969.33
List Price:  P1,384.82
You save:  P415.49
KSh9,413.65
List Price:  KSh13,448.65
You save:  KSh4,035
E£3,352.26
List Price:  E£4,789.16
You save:  E£1,436.89
ብር3,973.96
List Price:  ብር5,677.33
You save:  ብር1,703.36
Kz58,616.62
List Price:  Kz83,741.62
You save:  Kz25,125
CLP$66,678.07
List Price:  CLP$95,258.47
You save:  CLP$28,580.40
CN¥507.14
List Price:  CN¥724.52
You save:  CN¥217.38
RD$4,110.44
List Price:  RD$5,872.31
You save:  RD$1,761.87
DA9,401.90
List Price:  DA13,431.87
You save:  DA4,029.96
FJ$160.42
List Price:  FJ$229.18
You save:  FJ$68.76
Q543.26
List Price:  Q776.12
You save:  Q232.86
GY$14,630.45
List Price:  GY$20,901.55
You save:  GY$6,271.09
ISK kr9,795.80
List Price:  ISK kr13,994.60
You save:  ISK kr4,198.80
DH709.23
List Price:  DH1,013.23
You save:  DH303.99
L1,246.59
List Price:  L1,780.93
You save:  L534.33
ден4,020.35
List Price:  ден5,743.61
You save:  ден1,723.25
MOP$563.94
List Price:  MOP$805.67
You save:  MOP$241.72
N$1,340.22
List Price:  N$1,914.68
You save:  N$574.46
C$2,572.43
List Price:  C$3,675.06
You save:  C$1,102.63
रु9,316.74
List Price:  रु13,310.19
You save:  रु3,993.45
S/259.29
List Price:  S/370.43
You save:  S/111.14
K265.67
List Price:  K379.55
You save:  K113.87
SAR262.50
List Price:  SAR375.02
You save:  SAR112.51
ZK1,825.88
List Price:  ZK2,608.51
You save:  ZK782.63
L324.76
List Price:  L463.96
You save:  L139.20
Kč1,644.30
List Price:  Kč2,349.11
You save:  Kč704.80
Ft25,615.12
List Price:  Ft36,594.60
You save:  Ft10,979.47
SEK kr760.35
List Price:  SEK kr1,086.27
You save:  SEK kr325.91
ARS$61,118.20
List Price:  ARS$87,315.45
You save:  ARS$26,197.25
Bs482.97
List Price:  Bs689.99
You save:  Bs207.01
COP$272,384.35
List Price:  COP$389,137.18
You save:  COP$116,752.82
₡35,055.79
List Price:  ₡50,081.85
You save:  ₡15,026.05
L1,725.31
List Price:  L2,464.83
You save:  L739.52
₲519,197.15
List Price:  ₲741,742.01
You save:  ₲222,544.85
$U2,684.12
List Price:  $U3,834.62
You save:  $U1,150.50
zł281.58
List Price:  zł402.27
You save:  zł120.69
Already have an account? Log In

Transcript

Hello and welcome to the 13th tutorial in the caucus to the Flappy Bird c++ series. And in this part when we're looking at implementing the game over scene, we'll be using the source code as usual from the previous part of the series. So if you don't have it, don't worry the bill link in the description to the source code. The scene will contain four main elements the background, which will be the same as the game and the main anything retrieved by turn a main menu button. The score which will be passed into the scene when it is constructed, hence the scene will need to be modified. But the scoring system we won't be implementing directly yet that is going to be in over the next few tutorials.

So let's add the first let's add the background First, we will just copy and paste the code from the main menu, add it in the same model we use code is literally this one here. Copy and paste the background copy, go to our demo site. That was almost forgot pasted into there the background has been added now we can declare the go to Main Menu scene function and then go to game scene function in the game our scene header so we're going to create a private methods go to the main menu scene and in here I do know I've missed that avoid I'm going to pray in a second goes to the ref Asterix sender and then he'll avoid copy and paste this and the only thing we want to change for this one is going to gain seen as needed. Get rid of the menu and go to game menu scene.

Okay, so before we create the menu and implement the functions, let's include the main menu scene game scene and definitions header. So okay. Hash ping clean game scene as we'll need to access the game scene to restart the game hash include Main Menu thing we'll need this if you click the menu button to go to the main menu theme, and we'll need a definition I hate a bit of stuff like transition time to deaf initial header, we will not implement the go to mini scene and go to gating function so the stand here and void game up in go to Main Menu. And in here, the go to Main Menu we're going to put auto theme, Main Menu scene Cancun create scene. So we're creating a local instance of the main menu scene and witness in an equal voice. And now we just need to replace The quality of the director get instance, replaced seen and him do transition fade Comicon create and for the duration of a trend dish and on the spot time for the scene as for the scene that we just created.

Again, we're not gonna have any color variables keep keep choosing that particular transition. And now what we can do to make this simple and easy for us, we can copy and paste this and all we need to change is to go to main menu to go to gain. Change the main menu here to gain and that is it, we can now add the Create menu items will mean that we can create the menu items and add the menu to the scene. So we'll do that in the constructor right here. Don't do auto retry. Alright, default menu I turn damage colon colon create.

And we're going to be using this right here. So for the normal image we're going to be the retry button a PNG, which is this image right here. For the selected image, we're going to be using this one here we try button clicked. So we'll do retroarch dot png. And for the callback what we're going to specify for the callback is cc underscore call back while the only takes one parameter. Select is going to game overseen CRO Cloonan go to Main Menu theme.

And for the target we're gonna put this and now the next thing we're gonna do is set the position of this so let's retry item vision and the position it can be point it's gonna be centered in the x axis. So I've been brought up with about two plus our agenda x over the y axis that was slightly different. And we're going to do visible sois dot height. Before we fought on employees three, or weakness do the equivalent of time they timed him his boss sized a hide by five, and what this will do is your position that three quarters of the way up and the reason we're doing that is position the other item A quarter of the way up and in between there. Over the next few tutorials we'll be implementing score. We'll show you what we mean when we actually run it.

The next thing we're going to do actually simply copy and paste this in this chain rockin need to change. So change this to Main Menu, we can change this to the menu, we're using These two images Okay, I just made a mistake here. This is just the go to gaming scene. Hopefully you notice that if you haven't, don't worry and this is just the go to Main Menu scene and in here, change this main menu everything looks a okay now and now what we're going to do is simply create our menus so when we goto menu equals menu colon colon create and for the menu, specify the two items and those two words and then the retry item main menu where the hell did them pocus ago in the selector hate what happened? main menu item and what we're gonna do is known right there it is position on the menu.

So menu, set position for this one point column column zero. The reason we're doing this is because we set the individual item position, so we don't need the Menu set at this show you can add the menu. And now we want this Oh, we should have a when we die, we'll have a screen with a background retry button our main menu button click the promoter that should take us again see it click the menu button, it should take us to the menu so let's just died taking a while. And now that we have just done that right there had to also change this to divide by four as we want it to the quarter before do developer four times one, but there's no point doing extra calculation when it's going to end up being Everything is up. So let's run this again. Oh, it's something that you forget.

So let it go down. Boom, we got retry and menu. And like I mentioned before we got the space here, this is where the score and the high score will be displayed on the next few tutorials. Click retry back to the main menu, I mean, go back to the game thing. And once we die again, we'll click the menu button and we'll we should go back to the main menu. Just another thing that I want to mention which really Flappy Bird was more to do with Coco's to dx and how amazing it is.

I mentioned the end that we set in the position to zero. Imagine if you wanted to do some sort of animation where you just wanted to move the entire menu, maybe to the left or the right or you wanted to do something to the entire menu where there was the same for each of its items, instead of saying instead of doing an actual for retry item, then applying I mean running then doing an actual main menu item then running it and however many other items you have, you could just do one action running on the menu and you'll do it for all the items which I think is really really cool. Well for just mentioned that the next tutorial will cover displaying the player's score. If you have any questions feel free to message us at support at sono systems. Dakota UK. email will be in the description you can comment in this video, which is directly messages via YouTube, or the recording for source code will also be in the description.

And as usual, thanks for watching and have a nice day.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.