1 00:00:00,000 --> 00:00:02,279 Okay we're getting close now, we're getting close. 2 00:00:02,279 --> 00:00:05,269 There's just this moment, I can see it, there's two bubbles, we're soon 3 00:00:05,269 --> 00:00:07,914 going to have a thousand bubbles, it's very exciting. 4 00:00:07,914 --> 00:00:10,685 So we're, what do we have so far? We know how to declare, 5 00:00:10,685 --> 00:00:12,952 this list of numbers; integers. 6 00:00:12,952 --> 00:00:15,604 We were going to look at an example that used a list of integers, 7 00:00:15,605 --> 00:00:18,699 and maybe that's a bit of a mistake, and I'll try to fit that in again 8 00:00:18,699 --> 00:00:21,012 somewhere. But you know, think about that, how might you do that? 9 00:00:21,012 --> 00:00:26,081 But what I want to move straight to is saying, "Let's apply this thinking 10 00:00:26,081 --> 00:00:30,416 to these bubbles." And instead of having separate bubble object variables, lets 11 00:00:30,416 --> 00:00:32,779 have a single list of bubble objects. 12 00:00:32,789 --> 00:00:36,719 So if we look at this syntax, the first thing we have is the type of the array. 13 00:00:36,723 --> 00:00:40,091 Now we're going to have a type "Bubble" the object "Bubble". 14 00:00:40,091 --> 00:00:44,091 We need to make sure it's going to be an array, great we need to give our array a 15 00:00:44,093 --> 00:00:48,805 name, let's call it "Bubbles". The wire's a good joke, just thinking of 16 00:00:48,805 --> 00:00:52,565 the wire, because of the name, "Bubbles", but you didn't really need to know that. 17 00:00:54,725 --> 00:00:57,544 I think I should make some magic way, where I could just like, edit out 18 00:00:57,544 --> 00:00:58,708 unnecessary thoughts. 19 00:00:58,708 --> 00:01:04,424 Okay um... and then we need to say how many bubbles are we going to have in our 20 00:01:04,424 --> 00:01:09,093 array; we're going to have two. We're not getting very ambitious here, we're getting 21 00:01:09,093 --> 00:01:13,796 very very basic simple, we're going to have just two, um, I also by the way 22 00:01:13,796 --> 00:01:16,828 noticed, there's this little monitor that I look at, which is slightly above the 23 00:01:16,828 --> 00:01:19,219 camera, I feel like I'm always looking above the camera. But if I look this way, 24 00:01:19,219 --> 00:01:21,724 I'm looking right at the camera, right at you. 25 00:01:21,724 --> 00:01:28,864 Okay, so let's try to apply this here. So, what's going on? Look, bubble, let's 26 00:01:28,864 --> 00:01:32,368 close this, Bubble b1; Bubble b2; first of all, you know 27 00:01:32,368 --> 00:01:38,280 we really should've done this, just to get us in that frame of reference, of 28 00:01:38,280 --> 00:01:40,942 thinking of counting from zero, from the rest of your life, you should 29 00:01:40,942 --> 00:01:44,084 just count from zero from now on, always start at zero. 30 00:01:44,084 --> 00:01:49,671 Okay, uh... what I want to do is instead of having two separate variables, I want 31 00:01:49,671 --> 00:01:57,692 to have an array, called "bubbles", it's going to be of type "Bubble", it's 32 00:01:57,692 --> 00:02:00,404 got the brackets, which means it's an array, we name this "bubbles", 33 00:02:00,404 --> 00:02:05,306 and it has two bubbles in it. There's a lot of bubble everywhere but you know, 34 00:02:05,326 --> 00:02:07,419 this is what's happening to us right now. 35 00:02:07,419 --> 00:02:20,006 So we can get rid of this. Now, instead of initializing a single bubble... 36 00:02:20,006 --> 00:02:25,745 we can now refer to the bubbles by their index value, we can say, "Bubbles index 0 37 00:02:25,745 --> 00:02:29,565 make a new bubble." "Bubbles index 1 make a new bubble." 38 00:02:29,585 --> 00:02:34,572 So, its like we had two separate variables but both of those variables exist as spots 39 00:02:34,572 --> 00:02:39,233 in a list. You can imagine this list with two spots in it, and there's one bubble 40 00:02:39,233 --> 00:02:45,398 here, and another bubble there. Um, okay, so what do we do now? 41 00:02:45,398 --> 00:02:47,629 We need to take this idea and say, 42 00:02:47,629 --> 00:02:51,847 bubbles[0].ascend(); bubbles[0].display(); bubbles[0].top(); 43 00:02:51,847 --> 00:02:59,675 bubbles[1].ascend(); bubbles[1].display(); bubbles[1].top(); 44 00:03:03,495 --> 00:03:08,343 There we go, we have the identical program, just what we had before. 45 00:03:08,343 --> 00:03:13,699 Okay, so you know what? I'm just going with this, I'm experimenting with shorter 46 00:03:13,699 --> 00:03:16,320 videos, this has only been two, two and a half minutes (3 mins 17 seconds actually), 47 00:03:16,320 --> 00:03:20,519 but let's actually stop here, so this is a good, obviously this is a huge problem 48 00:03:20,519 --> 00:03:25,377 right? We've kind of done nothing to, to get towards our goal of having a thousand 49 00:03:25,377 --> 00:03:30,114 bubbles right? Yes, we've put it in a list but we still have individual lines of code 50 00:03:30,114 --> 00:03:33,379 for each bubble, we have to say, bubbles[0].all the functions; 51 00:03:33,379 --> 00:03:34,357 bubbles[1].all the functions; 52 00:03:34,357 --> 00:03:37,358 then if we had a thousand, two and three and four all the way up to 999. 53 00:03:37,358 --> 00:03:41,281 So, we're on the way there but we're missing an important step, and that 54 00:03:41,281 --> 00:03:43,668 important step is going to be using a loop, and that's we're going to be doing in the 55 00:03:43,668 --> 00:03:47,453 next video. But, let's take a moment to pause here and what I would say to you as 56 00:03:47,453 --> 00:03:51,455 an exercise is go find something where you had an object and try to make an array of 57 00:03:51,455 --> 00:03:55,635 those objects. Try to make multiple objects and use the array, don't just 58 00:03:55,635 --> 00:03:59,291 and refer to which object by its index value. 59 00:03:59,291 --> 00:04:04,251 You can do interesting things like, um, I could say, if I wanted to that this second 60 00:04:04,251 --> 00:04:08,139 one shouldn't bother to ascend, only the first one [needs to ascend]. 61 00:04:08,139 --> 00:04:11,265 You can see the second one, now doesn't have that function called on it, so it's 62 00:04:11,265 --> 00:04:17,383 just laying there at the bottom, so that's what I would say to you, take your object 63 00:04:17,383 --> 00:04:21,221 that you made make an array of them and try to see how that works.