 Hello world, it's the surfing scratcher here bringing you another video connecting the world of maths with the world scratch If you haven't already check the description below for previous videos as this one is part of a series in this video We're going to be exploring connecting our expanded notation of all the variables to the score in the top left-hand corner Over there of our space failure game. So let's get stuck into it Okay, so I've got our space failure project open here and I've completed the Hundreds and the thousands code as well. So if I just give this green flag a click a press and then I click all our objects here You can see our scores are updating as they should be which is just what we want it to be doing Okay, I hope you went along and did that if you haven't maybe pause the video and probably copy down what we've done here I've done that all in our place value heading here The next thing that we need to do is connect our place value headings here our variables And actually combine them. So we've got our score one up here So how we're going to do that? Well, let's go across to our planner and I've got a new planner up here And as you can see I've got our stage and our stage has different Numbers filled in for each place value. I've got 1000 in my thousands. I've got 200 here Ten for my tens and two units, okay? Now we know our expanded notation is if we were to add all these together we would get One combined whole number. So if we were to do that, we would get 1000 we would get 212 okay 1 2 1 2 there you go as you can it's probably sport It's taking the first number of each of those place values Okay, one thousand two hundred and twelve. So we actually want that number to go up here. So how are we going to do that? Well, we've got all of our variables here, and we know that we actually just want to add them together So we can do that in our scratch project and I'm going to show you how so let's go back across to our project To implement our plan. All right, so we're currently in our place value sprite Where we're going to be doing this is we've got a bit of interesting code on our stage here Now I'd like to put code in the stage that doesn't really have a visual element related to it Our score lives kind of on its own. It doesn't have a visual element attached to it It's the same thing for our variables here, and you could have put all this code in the stage as well So what we're going to be doing is placing our code on the stage backdrop, okay? Now I encourage you to have a browse around to see what all this code is doing But we're going to be focusing on a block that's been created for us called update score This is going to be a custom block Okay, now let's just go through this to see what it does. So when the green flag is pressed Okay, when this green flag is pressed, we're going to set the score to zero So it's the score here. I'm going to set the units to zero We're going to set the tens the hundreds thousands and the ten thousands to zero as well There's no ten thousands that you can see but the variable exists We've also got a delay here. We won't worry too much about that one right now And after we've settled that we've got this control statement here This forever loop and that means it will do something if you allow it to for ever like forever ever And what that will do it's going to be calling This this block here update score forever So it'll like call update score and then we'll do it again. You just like do it all the time So the reason we're going to be using this is whenever there is a change to our variables It will immediately update our score. Okay, so that is going to be our plan that we're going to implement right now So you'll see as soon as I click this green flag all of these values will be wiped here. We go boom Okay, they're all to zero, which is what you would expect it now It's calling update score, but we've got nothing to update at the moment because there's nothing inside of it So let's go and do that. We know with our plan If we were to take all of these variables and we were to add them together then we would get this number here One two one two, so let's actually go ahead and do that what we need to do is We want to set our score to a particular number so we're going to go across to our variables and We're going to be grabbing the set block. So let's go and set our Score, okay Now at the moment, it's just going to set score to zero all the time So if I press this green flag, it's going to set score for update this to the number one He will always set scored a number one if I put it to any number possible. It will just Update it to that number. That's not what we want. We want to remember add all these numbers together Okay, all of our thousands to our hundreds to our tens to our units Where we do that is we need to go back into our operators whenever we want to do some Action or some work between like numbers like math calculations Sometimes with words when we want to combine them together You're going to be getting pretty comfortable with this operator section because lots of number of stuff that we're going to be exploring Yeah, the one that we're interested in is adding things together so We are going to be adding our thousands and our hundreds together We could start with the units. It's really up to you It actually doesn't matter the order that you add these in so I'm going to go across and get my thousands variable and Then I'm going to go across and get my hundreds very Now I Encourage you to play around with this and play around with the order to see if it changes because for some operations It makes a difference for others. It doesn't okay So it's really cool to just go around and play with it now I want to go ahead and add my hundreds as well And I'll pop that in there, but then it kicks out my thousands and then it kicks it out again So that's not really working. I need to do something. Sorry. I've already got my hundreds there I need to add in my tens. I Can't do that. So what do I do? Well, I'm just going to go ahead and grab another Operator block this addition one. I'm going to stick that one at the front like that and You know what? I'm actually going to stick it here So it's a bit easy to see and then I can put my tens in at the front Cool now I'm going to go get my units because I also need to add my units now. Let's put my units in there and oh Same deal same deal. Yo, so what we need to do is go ahead and go grab out another And this is potentially going to be our final one depending on where you want to stop this We're going to chuck that big block there In the second part and then we're going to start by adding it so units tens hundreds thousands cool so At the moment that's still not going to work because this block is sitting outside of our score So we're not setting anything, but now let's stick it inside it now as soon as I press the green flag It'll be calling it, but we haven't hit anything yet So if I press one of these objects, we'll see it update and then ask or update to so whoops I missed that one there is 1000 and look boom 1000 straight away It's at a couple of units in there. I missed one and there's a hundred so got 1100 and one Let's go one thousand two One and I need a ten to get that same number that we had. Let's wait for a planet there. It's cool. All right Let's stop our game We've got one two one two one thousand two hundreds one ten and two units And that is exactly what we had in our plan as well so now our game is fully functioning and we have Just completed space value and they can go off and play it at home. You've got a version To play with friends family show it off to your uncles and aunts or whoever you want That's it for this video and that's a wrap for our series on space value If you enjoyed this video hit the thumbs up button If you want to know when the next series is released or the next video hit that subscribe button Drop me a comment below to let me know how I can make these videos and these projects awesome for you But until then I'm off to find wave. Take it easy