1 00:00:00,000 --> 00:00:00,370 2 00:00:00,370 --> 00:00:02,450 >> SPEAKER 1: Let's take a look at another program I've been working on. 3 00:00:02,450 --> 00:00:05,200 This one involving two Muppet's playing Marco Polo. 4 00:00:05,200 --> 00:00:07,580 A game in which one person says Marco, to which the other 5 00:00:07,580 --> 00:00:09,330 person responds Polo. 6 00:00:09,330 --> 00:00:12,360 >> This program is going to allow us to introduce a new programming construct 7 00:00:12,360 --> 00:00:13,670 known as events. 8 00:00:13,670 --> 00:00:17,650 Whereby one of these Muppet's is going to be able to broadcast an event so to 9 00:00:17,650 --> 00:00:20,790 speak, signifying that he has said Marco. 10 00:00:20,790 --> 00:00:24,500 The other Muppet meanwhile is going to be listening for that event, thereby 11 00:00:24,500 --> 00:00:27,450 responding to the other saying Marco. 12 00:00:27,450 --> 00:00:28,660 So let's take a look. 13 00:00:28,660 --> 00:00:30,600 >> Here we have the orange Muppet's scripts. 14 00:00:30,600 --> 00:00:33,720 And what he's doing is, when the green flag is clicked he's 15 00:00:33,720 --> 00:00:35,100 forever doing the following. 16 00:00:35,100 --> 00:00:39,650 If the space bar is pressed, than he is going to say Marco for two seconds 17 00:00:39,650 --> 00:00:40,510 on the screen. 18 00:00:40,510 --> 00:00:44,250 But he's also going to broadcast something we'll arbitrarily call an 19 00:00:44,250 --> 00:00:45,920 event in this case. 20 00:00:45,920 --> 00:00:46,860 And that's it. 21 00:00:46,860 --> 00:00:50,400 >> And any time I hit the space bar, he's not only going to say Marco on the 22 00:00:50,400 --> 00:00:53,170 screen, he's going to broadcast that event. 23 00:00:53,170 --> 00:00:56,950 Now, for simplicity I've called that event EVENT, but I could have called 24 00:00:56,950 --> 00:00:58,100 it most anything. 25 00:00:58,100 --> 00:01:01,300 Because Meanwhile the blue Muppet is going to be listening for that event 26 00:01:01,300 --> 00:01:05,010 with the following very simple code. 27 00:01:05,010 --> 00:01:09,540 >> All this Muppet is doing is upon receiving that event he's going to say 28 00:01:09,540 --> 00:01:11,420 Polo for two seconds. 29 00:01:11,420 --> 00:01:14,090 Indeed, any time he receives that event he's going to 30 00:01:14,090 --> 00:01:16,200 say Polo on the screen. 31 00:01:16,200 --> 00:01:18,810 So there you have it, with just a couple of pieces here, and a few more 32 00:01:18,810 --> 00:01:22,810 puzzle pieces there, we have two Muppet's playing Marco Polo. 33 00:01:22,810 --> 00:01:26,030 >> Let's see what happens when we click the green flag. 34 00:01:26,030 --> 00:01:30,110 I'm going to have to now hit the space bar, so that the orange Muppet says-- 35 00:01:30,110 --> 00:01:31,550 and so that the blue Muppet then says-- 36 00:01:31,550 --> 00:01:34,713