 Right, let's do something very very silly in this absolutely cursed software This pixel art health bar kind of old-school video game type thing Press the button. Hey look it increases and it decreases. There's just a little spin button Lowering and raising that bar and you might think actually that's really easy just draw this somewhere and then paste it into A bar chart and you know, yeah, that probably would be easy But you know, you've got to scale it right to get the pixel art effect So actually this is way way worse than that. Let me come to my u-tab and put the headings and the grid lines on This is actually the cells being conditionally formatted to make the effect There may be like a legitimate use for this technique if not it's just a bit of fun playing around So let's start up a new sheet to do this The first thing's first. I'm just going to grab a load of columns I'm sure there's a faster way of doing this, but I just cannot be bothered to learn it and then just make them square Ish, so I'm dealing with some squares There we go. Now we can color these in as we like And the first things first. I'm going to create a grid of four cells up here Um This example here it's six by six cells, but I'm going to make it four by four just to make it a lot faster to Demonstrate and I'm going to add some conditional formatting to this Just with a color scale. There's nothing there to conditionally format. So first of all, I'm going to manage the rules and edit it and I'm going to set the lowest middle and highest to numbers and it's going to go zero one Two you don't need to pick these numbers. They're just quite convenient as long as you know where they are Highest color. I'm going to make white Middle color. I'm going to make actually I'll make it blue be a slight different color to the The example there and then I've already Rehearsed it earlier here make a dark teal kind of color slightly more artsy if you can kind of Make it darker and change the hue a little bit So okay and apply that Now if I type in number one, you can see that very intense blue color is going to appear Zooming use the space a little bit So what I need to do is kind of Draw myself a little gem knowing that zero is a really dark teal color Maybe I don't make it exactly zero. I might make a 0.2 and 0.4 0.6 0.8 do something like that And then up here. Maybe that makes that 1.5 1.5 1.5. It's obviously going to round off to two two two one Maybe 0.8 0.8 0.8 0.6 0.6 0.6 something like that and if we zoom out we can kind of see we've got that kind of gem effect It's got a little bit of a Shine into it. It's a bit darker here and we've also got a dark line here to separate it. So that's pretty good And the final thing I'm just going to highlight all of this Change the number format. It's a trick I've used before if you go to custom and type in three semicolons That uh overrides kind of the positive zeros and negatives to not render the number so the number completely disappears And the final thing I'm going to do highlight all of those again And I'm going to call that unit right click define name go through the name manager. It doesn't matter Here's my shortcut is that little window in the corner Now if I type in unit I get the numbers I don't get the formatting. So what I'm going to do is copy the whole thing Put it Yeah, I'll just start it here two three four Five copy the whole thing There you go. So 10 of these uh now this is really just to size it up So I'm going to put a black bar around it So not only do I know the scale of it. I've also pasted the conditional formatting. So if I completely delete this Well, I can start putting in numbers And it will color it in So that black border is being pasted in as well. So that's kind of optional But it was just kind of there to highlight that this is an area. I'm going to use so you can get rid of that border if you like And final thing I'm going to merge these cells here I'm going to call that health Because it's kind of a health bar. So Why not? Let's just call it that Do my black border around there Maybe make it I don't know seven Scale that up put it in the middle and what What's my pixel font was it the Minecraft style one. There you go. There you go Now it looks a bit like this So what can we do we can well We can kind of try and paste these in but we kind of want to make it dynamic as well related to this number Whatever this number is and one way we can do it is with a option called H stack. So these take any kind of arrays and they kind of stack them on next to each other H stack does it horizontally V stack will do it Vertically, so I'm going to take an H stack In my array, I'm going to say I called it a unit. So we're going to take both units there There you go I can stack those together. I can put a third one in a fourth one Then gets a bit tedious and maybe we want to put if statements here to Kind of read off this number and see if it's greater than this include it. Oh, that would take a while and kind of Would be really tedious and not very flexible So what we're going to do is realizing that that's recursive Use a lambda function and make it recursive These have all sorts of weird uses now, don't they? So, uh, let's begin with Setting up our lambda function. So what do I need for this? Well, obviously I'm going to need to have an input output type Thing I'm going to have to take this unit and I'm going to recursively stack a new one onto it Now because I've already labeled this area here is unit and this area's health I don't need to define those within the lambda function. They'll just be dealt with they don't don't need to be defined or imported and I need an I just kind of to initiate it as well. So this number needs to be Incremented every time you call the recursive function. So with those two in mind How am I going to escape this loop? Well, if I might index here is equal to the health Number Well, I just want to return whatever the input was Just like return it whatever we stop the function And if false, I want to call the function again. So I'm going to call it health If I spell it right health bar doesn't really matter what we call it I'm just calling it that because it's kind of a computer gaming health bar and then What does that function have? Well, I need to jump back to the beginning It's going to have an input and it's going to have I I'll do the I first in fact I we want to plus one And then we're going to close off all the brackets But what is this function? Well The function we're going to each stack So each stack the input with A unit that's it. That is all we are doing So each time We call the function. We're going to stack these together Add a new unit and increment I by one and once I which is health we stop so That's not going to do anything on its own. So I'm going to control c that to copy it Come to formulas name manager and c I've done that before health bar Paste that all in make sure I've named it the same thing. Okay that Now if I type in a health bar. Well, my input is going to be Uh, well unit I'm going to initiate it with an i Zero there we go. We now have seven health bars except Hang on This is eight. Here's the problem. Let's reduce this to zero The problem is that the input here is the initial unit. So even at zero We've got something in there now. We can't leave that blank. It will produce an error But what we can do instead Is initiate it with a sequence So sequence I'm just going to make it four rows Doesn't matter what they are, but what you'll see is we'll have Kind of a blank sequence here and then we will Uh start chaining these on so we'll make this four, you know, you can see here So what I'm going to do instead is control x that to cop to get rid of it And then paste it here just before and there's a little bit of a hack A way around so it just means the initial input here is going to be hidden And then we're going to start Adding things on so it would be lovely to just have that input as blank Kind of produces an error. So we've got to initiate it with just a blank sequence And we can hide that away and then we can start by chaining these together. So five seven Zero it's going to disappear ten fills the whole thing. So really Very very very Silly, maybe there is a legitimate use for this It somewhere Maybe it's not a pixel art thing. Maybe you need to generate some arrays a little bit bigger, but you know, uh There we have it