1 00:00:00,220 --> 00:00:01,540 So it will come back again. 2 00:00:01,620 --> 00:00:07,200 This lesson essentially the next few lessons will deal with flipping the tide and revealing what's behind 3 00:00:07,230 --> 00:00:09,920 it and then making a decision on that basis. 4 00:00:09,930 --> 00:00:15,330 So the very first step and this is at the very beginning of the game is when we stop on a tile that 5 00:00:15,330 --> 00:00:18,920 one should flip itself and reveal what's the value behind it. 6 00:00:18,930 --> 00:00:21,060 Now let's do that in this lesson. 7 00:00:21,090 --> 00:00:29,190 I'm going to go to this school and when I write a new file I'm going to call it let's say View Controller 8 00:00:29,730 --> 00:00:38,490 plus flip to reveal because it's the very first one that can be Taplin an item that one flips and reveals 9 00:00:38,490 --> 00:00:40,060 what's behind it. 10 00:00:40,200 --> 00:00:47,040 So to do that I'm going to go ahead and say I have a again the same thing as before and this is an extension 11 00:00:47,040 --> 00:00:48,780 to view controller. 12 00:00:48,870 --> 00:00:57,480 And then when I have a function and that function I'm going to call it flip to reveal And the flip to 13 00:00:57,480 --> 00:01:03,900 reveal is going to ask for an input to that view and that the value is reached while you want to reveal. 14 00:01:03,900 --> 00:01:05,870 So I'm going to say that's called Impe. 15 00:01:05,930 --> 00:01:10,170 Title of the type my label of course doesn't return anything. 16 00:01:10,170 --> 00:01:18,990 And here is the body of the function you I view the transition and the transition is to view. 17 00:01:19,080 --> 00:01:25,120 And again this is something we have seen if you are taking this as a part of the U.S. boot camp. 18 00:01:25,130 --> 00:01:30,960 Otherwise this is a transition that essentially takes a view and within a certain duration flips it 19 00:01:30,990 --> 00:01:34,570 or does one of the many animation options in this case. 20 00:01:34,710 --> 00:01:36,300 I'm going to use a flip. 21 00:01:36,300 --> 00:01:39,410 So it's called Philip let's say from left. 22 00:01:39,690 --> 00:01:45,360 And if they want to do this on is actually the input and the time I want to do this let's say it's point 23 00:01:45,390 --> 00:01:46,610 five seconds. 24 00:01:46,620 --> 00:01:51,760 The animation that they want to have they will see then as I can I don't have any completions. 25 00:01:51,810 --> 00:01:58,140 Now the animation is they want to see during this flip action or the flip transition is a few things 26 00:01:58,140 --> 00:01:59,850 one of them is time. 27 00:02:00,090 --> 00:02:03,060 Want him to have a different background color. 28 00:02:03,120 --> 00:02:04,970 Let's say a green color. 29 00:02:05,310 --> 00:02:13,760 And also I want the entire text to show the value that is holding its internal numbers. 30 00:02:13,950 --> 00:02:19,980 So it's going to be infantine dot internal number. 31 00:02:20,310 --> 00:02:29,250 So that should essentially give us a green back on tile with a text over that internal number of that 32 00:02:29,250 --> 00:02:31,770 type and the internal number is an optional value. 33 00:02:31,770 --> 00:02:35,030 I'm going to go ahead and make it a forced one wrapped one. 34 00:02:35,080 --> 00:02:38,160 Let me form out all of these and make it nice and tidy. 35 00:02:38,160 --> 00:02:44,340 Another They have that the next thing they need to do is I need to call this one every time I touch 36 00:02:44,430 --> 00:02:45,310 on a tile. 37 00:02:45,500 --> 00:02:50,610 So I'm going to put the touches and that and in yeah I'm going to say if the top tied was the right 38 00:02:50,610 --> 00:02:57,060 one do this flip to reveal a tapped type. 39 00:02:57,450 --> 00:02:59,510 So let's see if that's going to work. 40 00:02:59,640 --> 00:03:05,430 I'm going to tell you that something will not work the way we expected but I want to see it first and 41 00:03:05,430 --> 00:03:07,520 then I'm going explain how we can fix it. 42 00:03:07,530 --> 00:03:14,130 The thing that won't work is this text the value of the title because the values are already being shown. 43 00:03:14,130 --> 00:03:21,330 So the 5 is already shown and the 7 is shown but then I press 5 it flips becomes green and shows 5 once 44 00:03:21,330 --> 00:03:22,080 again. 45 00:03:22,080 --> 00:03:23,130 Same thing with seven. 46 00:03:23,130 --> 00:03:25,390 A thing with Sikh's so on and so forth. 47 00:03:25,590 --> 00:03:32,130 And to fix that I'm going to have to go to all my major tiles I need to make tiles very make every tide 48 00:03:32,160 --> 00:03:37,740 and everything is working and we have the right counter value placed inside the internal number. 49 00:03:37,770 --> 00:03:41,270 I'm going to say don't show it in the title text. 50 00:03:41,430 --> 00:03:50,250 Instead do this say every time the text becomes my label dodged the question mark and that is the reason 51 00:03:50,250 --> 00:03:51,920 why we had that question. 52 00:03:51,930 --> 00:03:58,410 If you remember quite a few lessons ago we had in the my label we had the question that was a question 53 00:03:58,410 --> 00:04:04,050 mark and that's the reason I had that there you could obviously go in here and say well this is just 54 00:04:04,080 --> 00:04:09,410 a question mark such as that one or you could use a static value question. 55 00:04:09,510 --> 00:04:15,210 And the reason I like to use this one is if I run the OP now we will see the question mark and that's 56 00:04:15,210 --> 00:04:16,460 something we expect. 57 00:04:16,550 --> 00:04:20,860 And I'm going to show you why I wanted to use the question mark and I'm going to change it to. 58 00:04:20,870 --> 00:04:22,190 Now we see the question why. 59 00:04:22,260 --> 00:04:23,940 We top it shows us two. 60 00:04:24,000 --> 00:04:25,480 This one shows us five. 61 00:04:25,570 --> 00:04:31,050 I could actually go ahead in here and say instead of a alphabetical order out of a numerical question 62 00:04:31,050 --> 00:04:36,170 mark show me a different one that searched for a question mark. 63 00:04:36,570 --> 00:04:39,800 I don't know if there is one sure there is quite a few of them. 64 00:04:40,020 --> 00:04:43,830 So maybe show me this one that's a little bit different. 65 00:04:43,830 --> 00:04:49,160 So it's actually an emoji question mark or some sort of a graphical question like. 66 00:04:49,380 --> 00:04:56,050 In any case having it as a static value helps me change all of them whenever I want to. 67 00:04:56,080 --> 00:04:58,290 Now that's not and that's that. 68 00:04:58,290 --> 00:05:06,620 So so far this and we manage to use the Philipe to reveal to successfully flip one of our tiles and 69 00:05:06,620 --> 00:05:10,670 show it's internal number and turn the colors green. 70 00:05:10,840 --> 00:05:12,710 So let's see what comes next.