1 00:00:05,600 --> 00:00:06,260 Hey everyone. 2 00:00:06,930 --> 00:00:13,390 So now we are nearly done with the program and we just need to add some few interactive keys here so 3 00:00:13,400 --> 00:00:16,670 that the will get to be local listeners and move according to us. 4 00:00:17,330 --> 00:00:26,720 So for that one I'm adding a few more keys here on Key and beginning with say moving up and define a 5 00:00:26,720 --> 00:00:28,130 function for that one. 6 00:00:28,430 --> 00:00:32,700 Same move up that we did not have defined yet but defined after this. 7 00:00:33,680 --> 00:00:36,910 And the key for that one is up. 8 00:00:37,070 --> 00:00:45,140 So except this base in most of the keys we have lost larger capital than the segments more than we have. 9 00:00:45,140 --> 00:00:59,290 Again this one's so now that one copy and the one on key Pence's copy this one command sea bass dipped 10 00:00:59,800 --> 00:01:13,150 thrice the second one is say move down and for that one we use the key down and the third one see move 11 00:01:17,100 --> 00:01:23,490 the scope left for that one we have capital and left. 12 00:01:23,660 --> 00:01:29,100 And the last one is move underscored right. 13 00:01:29,120 --> 00:01:35,300 And for that one we are going to have right maybe all already 40s and their motion. 14 00:01:35,310 --> 00:01:39,940 How would you define that what will happen on pressing these keys. 15 00:01:40,050 --> 00:01:42,060 So first one I have define 16 00:01:44,690 --> 00:01:54,560 move underscored up medial so for keys motion you need to define similarly all the functions for these 17 00:01:55,040 --> 00:02:01,720 and defining the keys functions are really really very easy but one thing you need to focus. 18 00:02:01,850 --> 00:02:10,230 Just imagine I have this that here and the imagine this one is my caterpillar I'm moving up for direction 19 00:02:11,220 --> 00:02:15,650 so one thing here I can agree to rest my path. 20 00:02:15,720 --> 00:02:20,660 The Caterpillar did not move in that direction like moving forward then it will not move like this but 21 00:02:21,840 --> 00:02:28,740 and the available positions at this condition like when this one is moving a foot it has only left and 22 00:02:28,740 --> 00:02:38,940 right similarly when this one is moving like this one then it has only left and right so the thing here 23 00:02:39,000 --> 00:02:47,670 is if I move want to move my caterpillar in up direction then then this one will move in a direction 24 00:02:48,330 --> 00:02:49,630 like when I'm moving downward. 25 00:02:49,860 --> 00:02:56,140 It cannot go up and when this one is already moving offered then they are not required to move that 26 00:02:56,140 --> 00:02:56,380 money. 27 00:02:56,400 --> 00:03:03,480 But so the two only possible conditions are when I'm moving in the right direction then I can move up 28 00:03:04,920 --> 00:03:08,040 and when I'm moving left direction I can move. 29 00:03:08,060 --> 00:03:17,810 But let me show you that one with the Caterpillar would be like so this one ghetto below would be why 30 00:03:18,760 --> 00:03:20,760 we have a caterpillar. 31 00:03:20,760 --> 00:03:23,760 So now I want to move up I can go up there. 32 00:03:23,940 --> 00:03:32,190 But now when I'm already going up so I cannot move in the backward direction right now where I'm already 33 00:03:32,190 --> 00:03:39,600 moving a virtual how I can move up again I can do this one only to position condition in this one. 34 00:03:40,020 --> 00:03:44,110 So now up and even this one up. 35 00:03:44,190 --> 00:03:50,680 So these are the two conditions in which I can go up and the conditions they are are. 36 00:03:50,700 --> 00:04:00,650 If Caterpillar not heading I can use heading so this is metal you can actually find the alignment or 37 00:04:00,650 --> 00:04:05,660 see angle of the particular motion or any turtle. 38 00:04:05,810 --> 00:04:13,440 So if that angle equal to zero degree or that is moving actually in the right direction. 39 00:04:13,730 --> 00:04:18,890 So that is actually what zero angle when we have a straight horizontal line moving in the right direction 40 00:04:18,920 --> 00:04:25,320 or pointed in the right direction or Caterpillar road heading 41 00:04:28,800 --> 00:04:33,000 this one equal to 180 degrees. 42 00:04:33,120 --> 00:04:35,850 It means it's moving in left direction. 43 00:04:35,910 --> 00:04:39,130 So in these cases what will I do. 44 00:04:39,210 --> 00:04:42,750 I will just Caterpillar not set heading. 45 00:04:42,750 --> 00:04:46,240 I will change the heading only so set heading. 46 00:04:46,350 --> 00:04:50,770 And I will set this heading to 90 degree a. 47 00:04:50,770 --> 00:04:54,310 Hope you get this one because this is the only thing you understand. 48 00:04:54,310 --> 00:05:01,000 And only once you need to understand after this one you will never require this one to get focus on. 49 00:05:01,120 --> 00:05:07,510 Just go through this one again if you do not understand this one I will again explain this one here 50 00:05:07,570 --> 00:05:11,850 in the down so move underscored down 51 00:05:14,910 --> 00:05:21,510 now in which positions I can move down when I'm moving either forward or even better then only I can 52 00:05:21,510 --> 00:05:25,780 move No so if might get to below. 53 00:05:25,780 --> 00:05:32,770 Again these two same commands heading with these two now we have. 54 00:05:32,970 --> 00:05:37,620 So then this one is heading in zero angle and 180 degrees. 55 00:05:37,800 --> 00:05:41,340 So what are zero wanted to do the right and left. 56 00:05:41,340 --> 00:05:51,300 So in this case I will make my caterpillar head heading sorry Do not Ninety 90 is going to be consider 57 00:05:52,220 --> 00:05:52,950 say. 58 00:05:52,970 --> 00:05:55,390 But this line this and this. 59 00:05:55,390 --> 00:05:57,440 So if this is my angle 0. 60 00:05:57,460 --> 00:06:00,630 This terminal boundary then this one is my angle 90. 61 00:06:00,640 --> 00:06:04,640 So in 92 to make this one up but with left also. 62 00:06:06,040 --> 00:06:09,770 And this is referred to as a 0 degree angle always. 63 00:06:09,790 --> 00:06:14,350 So if I want my caterpillar in downward direction. 64 00:06:14,530 --> 00:06:15,650 So what will I do. 65 00:06:15,820 --> 00:06:20,430 90 90 90 180 and 90 to 70. 66 00:06:20,530 --> 00:06:29,150 So I will move my heading to 270 decrease so in that way I will have distraction. 67 00:06:29,160 --> 00:06:37,420 If you want to Caterpillar moving like this V diagonally then you can also align angles like 45 135 68 00:06:37,600 --> 00:06:39,030 to 35. 69 00:06:39,120 --> 00:06:43,970 In that case it will move in those directions and no. 70 00:06:44,070 --> 00:06:49,260 Same for the same move up. 71 00:06:49,390 --> 00:07:00,390 So we have divided up moves right so in light when I can move in right direction say my caterpillar 72 00:07:00,850 --> 00:07:02,620 again we need you. 73 00:07:02,820 --> 00:07:06,330 So if I'm moving in a vacation I can move right. 74 00:07:06,450 --> 00:07:08,910 If I'm moving in downward again I can move in right. 75 00:07:09,180 --> 00:07:12,440 But when I'm moving in left direction I cannot move in the right direction. 76 00:07:12,510 --> 00:07:18,360 Even pressing one and when I'm already moving in the right direction I can hold I can move in that one 77 00:07:18,360 --> 00:07:27,050 because I'm already in that direction so the only directions you can change with right are the 90 degree 78 00:07:28,010 --> 00:07:31,360 that I'm already in 90 degree or delay. 79 00:07:31,370 --> 00:07:34,860 DONVAN now is 270 degree. 80 00:07:34,880 --> 00:07:43,600 So remember these 0 is always right 90s a when it is left and to 70s modem. 81 00:07:44,570 --> 00:07:52,880 So in that case to move that one in right just set the heading to zero degrees because zero is four 82 00:07:53,180 --> 00:07:55,010 right now. 83 00:07:55,010 --> 00:08:07,260 Copy this whole base to tail and define the left so the condition for left motion are also these 90 84 00:08:07,410 --> 00:08:14,220 and 270 because I can move left when I am either up or either down but the left angle is one hundred 85 00:08:14,220 --> 00:08:16,320 and eighty degrees. 86 00:08:16,320 --> 00:08:23,910 So this is all about the keys that how you can use keys and how you can define them motion and I hope 87 00:08:23,910 --> 00:08:24,780 you go to that one. 88 00:08:24,780 --> 00:08:28,620 The main function of this one is heading and set heading. 89 00:08:28,630 --> 00:08:38,490 Now let with driver program so maybe this one they will best start I'm getting this one going up direction 90 00:08:38,550 --> 00:08:42,480 perfectly left down right. 91 00:08:42,500 --> 00:08:44,300 So I'm moving perfectly fine. 92 00:08:44,300 --> 00:08:48,440 Only one thing I'm getting here this goes in center. 93 00:08:49,430 --> 00:08:53,930 So let me check that also why this one is happening maybe you'd do any better. 94 00:08:54,050 --> 00:08:55,160 Come on we left there. 95 00:08:55,640 --> 00:09:02,060 So I have taken belief in my school increases to 10 spirit and Lantana also increases and leaf is also 96 00:09:02,060 --> 00:09:03,220 working completely fine. 97 00:09:04,160 --> 00:09:08,450 So all of these things are working completely fine. 98 00:09:08,690 --> 00:09:11,800 Just this goal is something bothering us. 99 00:09:11,840 --> 00:09:14,420 So now let me check that by hitting ball. 100 00:09:14,510 --> 00:09:16,670 So game over but this court is here. 101 00:09:17,290 --> 00:09:20,090 So now that we check that what's happening with this ball. 102 00:09:20,330 --> 00:09:22,370 So that's actually displaced court. 103 00:09:23,060 --> 00:09:25,710 And here this is already. 104 00:09:25,710 --> 00:09:30,100 Right so here it is. 105 00:09:30,120 --> 00:09:37,650 So we have defined the coordinates x invite but we forget something like we are defining the position 106 00:09:37,680 --> 00:09:41,230 that we need to assign that X Y position. 107 00:09:41,310 --> 00:09:43,940 So just scored underscored. 108 00:09:43,950 --> 00:09:46,550 Total note said position. 109 00:09:46,680 --> 00:09:53,470 And this just X Y labial say this one run it again. 110 00:09:53,490 --> 00:09:59,080 So this is something I feel that way at that particular position because of defining this come on a 111 00:09:59,100 --> 00:10:00,680 line right before that. 112 00:10:01,800 --> 00:10:02,840 So sort of all that fun. 113 00:10:02,860 --> 00:10:05,400 And let me check of a program maybe. 114 00:10:05,940 --> 00:10:13,150 So now we have a low score at proper position and now let's check the booking. 115 00:10:13,200 --> 00:10:16,320 We have the caterpillar moving perfectly. 116 00:10:16,320 --> 00:10:19,820 Now the leaf oh let go 117 00:10:25,670 --> 00:10:28,220 there we have everything working fine. 118 00:10:28,320 --> 00:10:32,360 So here we have a caterpillar working completely fine in my game is over. 119 00:10:32,770 --> 00:10:34,770 And I hope you enjoyed this fun. 120 00:10:34,920 --> 00:10:36,120 So thanks for watching. 121 00:10:36,120 --> 00:10:40,050 In the next module we will build different projects. 122 00:10:40,050 --> 00:10:40,740 So see the.