1 00:00:00,300 --> 00:00:02,001 in this tutorial we are going to 2 00:00:02,009 --> 00:00:05,580 use logic comparisons these are comparisons for 3 00:00:05,580 --> 00:00:08,850 which the outcomes true or false first 4 00:00:08,850 --> 00:00:10,860 we go to operators and we select 5 00:00:10,860 --> 00:00:14,190 this script here we compare only ask 6 00:00:14,310 --> 00:00:16,260 is the last number less than the 7 00:00:16,260 --> 00:00:18,540 right number and the answer is either 8 00:00:18,570 --> 00:00:19,650 true or false 9 00:00:20,190 --> 00:00:22,110 the next one is greater than we 10 00:00:22,110 --> 00:00:24,120 ask as the last number greater than 11 00:00:24,120 --> 00:00:26,130 the right number and the answer is 12 00:00:26,130 --> 00:00:28,260 true or false the next one is 13 00:00:28,260 --> 00:00:30,780 an equal comparison we ask is the 14 00:00:30,780 --> 00:00:32,670 last number the same value as the 15 00:00:32,670 --> 00:00:34,200 right number and the answer will be 16 00:00:34,200 --> 00:00:36,120 true or false we can use the 17 00:00:36,120 --> 00:00:38,280 outcome of these comparisons to control some 18 00:00:38,280 --> 00:00:40,320 actions so to do this 19 00:00:40,350 --> 00:00:42,750 we need to go to motion and select turn 20 00:00:42,750 --> 00:00:45,900 clockwise and next from the control menu 21 00:00:46,020 --> 00:00:49,080 we will need forever and if then 22 00:00:53,190 --> 00:00:56,370 finally from sensing we want to use 23 00:00:56,910 --> 00:01:00,210 distance to also don't forget to click 24 00:01:00,630 --> 00:01:01,620 the green flag 25 00:01:04,349 --> 00:01:06,181 first of all we want to turn 26 00:01:06,181 --> 00:01:09,690 the sprite continuously for example one degree 27 00:01:09,690 --> 00:01:10,770 at a time forever 28 00:01:12,000 --> 00:01:14,280 here you can see that the sprite 29 00:01:14,430 --> 00:01:17,790 continuously turns without any type of control 30 00:01:25,590 --> 00:01:27,240 now we want to make the sprite 31 00:01:27,240 --> 00:01:29,970 turn when a certain condition is true 32 00:01:30,810 --> 00:01:31,950 for example 33 00:01:34,230 --> 00:01:36,630 we can use the less than operation 34 00:01:37,110 --> 00:01:40,740 and distance to mouse pointer less than 35 00:01:40,770 --> 00:01:45,060 for example ninety then turn one degrees 36 00:01:45,720 --> 00:01:48,030 the distance to the sprite is measured 37 00:01:48,030 --> 00:01:50,400 from this point and this example we 38 00:01:50,400 --> 00:01:53,160 can see zero zero ninety here 39 00:01:53,160 --> 00:01:53,280 is 40 00:01:53,310 --> 00:01:56,400 equal to three boxes so when the 41 00:01:56,400 --> 00:01:58,260 mouse is more than three boxes away 42 00:01:58,260 --> 00:02:00,030 from the script it will not turn 43 00:02:00,390 --> 00:02:01,620 the as you could see when we 44 00:02:01,620 --> 00:02:03,480 bring them as close to the sprite 45 00:02:03,510 --> 00:02:05,894 it starts to rotate and when we move it 46 00:02:06,000 --> 00:02:07,410 away it stops 47 00:02:12,000 --> 00:02:15,210 next we can try another comparison if 48 00:02:15,210 --> 00:02:16,620 we use the more than 49 00:02:17,790 --> 00:02:19,950 so if the distance to the mouse 50 00:02:20,160 --> 00:02:23,160 pointer is more than here you can 51 00:02:23,160 --> 00:02:25,140 see that if the mouse is close 52 00:02:25,140 --> 00:02:26,940 to the sprite it doesn't move but 53 00:02:26,940 --> 00:02:28,890 when the mouse moves further away from 54 00:02:28,890 --> 00:02:30,990 the sprite it starts to move 55 00:02:35,130 --> 00:02:38,340 the last comparison is equal to the 56 00:02:38,340 --> 00:02:40,380 distance has to be exact for the 57 00:02:40,380 --> 00:02:41,460 sprite to move 58 00:02:42,990 --> 00:02:44,580 let's choose ninety again 59 00:02:50,520 --> 00:02:52,710 so here we can see that the 60 00:02:52,710 --> 00:02:55,500 mouse has to be exactly three boxes 61 00:02:55,500 --> 00:02:58,800 away otherwise the sprite will not rotate 62 00:03:04,380 --> 00:03:06,060 this is quite tricky to find 63 00:03:21,450 --> 00:03:23,130 so here we have seen how to 64 00:03:23,130 --> 00:03:26,400 use comparisons of less than greater than 65 00:03:26,790 --> 00:03:28,290 and equal to