1 00:00:00,390 --> 00:00:02,460 in today's video tutorial we're going to 2 00:00:02,460 --> 00:00:04,350 be learning about how to use the 3 00:00:04,350 --> 00:00:06,720 if statement blocks using the online version 4 00:00:06,720 --> 00:00:08,760 of scratch as you can see a 5 00:00:08,800 --> 00:00:11,430 new project open for the purpose of 6 00:00:11,460 --> 00:00:13,290 today we're going to be using four 7 00:00:13,290 --> 00:00:17,220 different tabs the looks tab events control 8 00:00:17,250 --> 00:00:19,620 and then sensing i'm going to start off 9 00:00:19,620 --> 00:00:20,160 by navigate 10 00:00:20,160 --> 00:00:22,020 get into the control tab and selecting 11 00:00:22,020 --> 00:00:23,700 the different blocks that will be using 12 00:00:24,150 --> 00:00:26,430 those blocks are the if then block 13 00:00:26,610 --> 00:00:29,220 and if then else block with 14 00:00:29,220 --> 00:00:31,740 these blocks essentially we will be saying is 15 00:00:31,740 --> 00:00:35,850 that if something happens such as our 16 00:00:35,850 --> 00:00:38,400 mouse pointer is touching our cat sprite 17 00:00:38,790 --> 00:00:40,320 then we want this action 18 00:00:40,320 --> 00:00:41,070 then to occur 19 00:00:42,600 --> 00:00:44,850 and in order to use this one 20 00:00:44,880 --> 00:00:47,010 it's essentially the same but what we're 21 00:00:47,010 --> 00:00:50,640 saying is if our mouse pointer 22 00:00:51,900 --> 00:00:53,610 is touching the cat then we want 23 00:00:53,610 --> 00:00:57,000 this action to occur otherwise we want 24 00:00:57,270 --> 00:01:00,000 a secondary action to occur let's go 25 00:01:00,000 --> 00:01:01,170 ahead and go back up to this 26 00:01:01,170 --> 00:01:03,270 first block and look at that first 27 00:01:04,260 --> 00:01:06,330 so in order to get a spot 28 00:01:06,330 --> 00:01:07,410 to work we're going to need a 29 00:01:07,410 --> 00:01:09,390 couple of things first we're going to 30 00:01:09,390 --> 00:01:11,070 need the action that we want to 31 00:01:11,070 --> 00:01:11,520 happen 32 00:01:12,510 --> 00:01:15,180 let's go to looks and say that 33 00:01:16,470 --> 00:01:17,190 we want 34 00:01:18,510 --> 00:01:22,020 this sprite to hide when the mouse 35 00:01:22,020 --> 00:01:23,160 pointer is touching it 36 00:01:24,300 --> 00:01:25,740 what we need to do in order 37 00:01:25,740 --> 00:01:27,930 to get this to work is we're 38 00:01:27,930 --> 00:01:29,550 going to have to navigate to the 39 00:01:29,550 --> 00:01:32,970 events and we can select when clicked 40 00:01:33,180 --> 00:01:35,520 and scroll down to control and put 41 00:01:35,520 --> 00:01:37,050 this in a forever loop 42 00:01:38,910 --> 00:01:40,260 we're also going to need to go 43 00:01:40,260 --> 00:01:43,590 back to looks and select show otherwise 44 00:01:43,655 --> 00:01:45,450 when the mouse would be touching the 45 00:01:45,450 --> 00:01:48,420 cat he would just be hidden forever 46 00:01:48,750 --> 00:01:52,710 because of the forever loop so let's 47 00:01:52,710 --> 00:01:54,510 go and select show 48 00:01:56,670 --> 00:01:57,570 one things here 49 00:02:00,840 --> 00:02:02,400 so when clicked 50 00:02:05,790 --> 00:02:07,435 when clicked i want my cat sprite 51 00:02:07,435 --> 00:02:10,080 to show and when my mouse pointer 52 00:02:11,310 --> 00:02:12,870 is touching him i want him to 53 00:02:12,870 --> 00:02:16,260 hide the simple as that now let's 54 00:02:16,260 --> 00:02:17,250 go ahead and move on to the 55 00:02:17,250 --> 00:02:17,910 next block 56 00:02:18,990 --> 00:02:21,630 going to go ahead and throw back 57 00:02:21,660 --> 00:02:24,780 that show and keep her forever whooped 58 00:02:29,250 --> 00:02:31,560 throw this one back and we're going 59 00:02:31,560 --> 00:02:33,660 to select the second if statement block 60 00:02:34,590 --> 00:02:36,240 we're back in the forever loop 61 00:02:37,230 --> 00:02:39,180 we're going to stick with this touching 62 00:02:39,180 --> 00:02:40,050 mouse pointer 63 00:02:41,340 --> 00:02:44,250 and we're going to say that we 64 00:02:44,250 --> 00:02:46,950 want him to 65 00:02:48,030 --> 00:02:48,660 hide 66 00:02:49,980 --> 00:02:51,930 and then show 67 00:03:08,190 --> 00:03:09,420 so when clicked 68 00:03:10,560 --> 00:03:13,200 we want this cat to hide when 69 00:03:13,200 --> 00:03:16,440 the mouse is hovering over it otherwise 70 00:03:16,440 --> 00:03:17,370 we want it to show 71 00:03:19,770 --> 00:03:21,210 and you can also do other things 72 00:03:21,210 --> 00:03:24,000 with this as well we can swap 73 00:03:24,000 --> 00:03:28,020 out the hide for let's say change 74 00:03:28,020 --> 00:03:28,890 costume 75 00:03:30,000 --> 00:03:30,960 or next costume 76 00:03:34,260 --> 00:03:35,400 so when clicked 77 00:03:36,690 --> 00:03:38,790 we want this cat to change it's 78 00:03:38,790 --> 00:03:39,450 costume 79 00:03:41,400 --> 00:03:42,990 when the mouse pointer is on it 80 00:03:43,380 --> 00:03:44,790 otherwise we just want him to show 81 00:03:44,790 --> 00:03:47,430 his regular costume the first one and 82 00:03:47,430 --> 00:03:49,620 we know that the second costume would 83 00:03:49,620 --> 00:03:52,080 be him running because we can navigate 84 00:03:52,110 --> 00:03:55,050 to the animal sprites and we can 85 00:03:55,050 --> 00:03:57,360 see by scrolling down here to the 86 00:03:57,360 --> 00:03:57,840 cat 87 00:04:01,140 --> 00:04:03,510 that when we hover over this we 88 00:04:03,510 --> 00:04:04,200 see him moving 89 00:04:05,460 --> 00:04:07,615 and that concludes our video tutorial for 90 00:04:07,624 --> 00:04:07,950 today