Hey there everyone today I’m going to show you how you can use make code for game design in Minecraft education Edition okay so this video is kind of similar to some that we’ve been putting out lately I’m going to go through how you can use make code so specifically block coding To introduce something like game design there’s actually a one note that goes with this as well I’ll put a link in the description so specifically designed for teaching students computational thinking around coding and then it progresses into a bit of the command block work as well but essentially we’re going to go Through and have a look at how we can use this coding in this particular way so the very first one we’re going to have a look at is how to give someone something and keeping in mind there are lots of ways you can kind of trigger the Process to happening I’ve just kind of created some silly scenarios in which it could possibly work so in this case what we have here is that we want to give our player an item if they break the block of gold that’s in front of us so our Agent here is telling us that we need to create this event whereby they’re given a torch when they break a block of gold so let’s hit C on our keyboard and that will open up our coding options and we want to choose this first one we’re Going to use make code there are other options there as well but we’re going to look specifically just at block coding and then what I’m going to do is I’ve kind of created one here already but you can create new project and we’re going to have a little it’s like a project Like a canvas space for us to work on now what I want to do is that I want to find what we call an event handler because all our code must sit inside an event handle the thing that causes the code to run so in this case we’re going To break something now you’ve got two options you can kind of Click through to get used to where they are in this particular case this one here is under blocks because I need to break a block and it’s sitting here um this one here that’s highlighted yellow it says on grass block broken Which we can change but the other thing you can do is you can start to search so if I start to write the word break or broken we can see that it will kind of shorten that list and that there is the one that I want let’s zoom in one there Now it’s going to default to grass but we just click down here and then I can change this to Gold there it is block of gold and so that change is made nice and simple the next thing we want to do is give and so give is actually a tricky One because give actually sits in mobs which seems really weird but again if you just search for it sorry write the word give and there it is there so if we pick this up place it inside our event handler it says we’re going to give the nearest player which is perfect so the Default is perfect you can change that if you needed to we’re going to give them a block or an item in this case we don’t want to give them grass we want to give them a torch so we search there it is and we’re just going to give them one Torch for now like all good code we want to test it so down in the bottom right hand corner we’re going to hit that green play button we’re going to come here and what we’re going to do is we’re just going to break this block of gold And then you’ll see down in my hot bar I was given a torch it wasn’t there before I’ve got another one there which is meaning my code is working let’s mix it up let’s say we wanted to try and change things here we want to change the code to give your player Three shovels when the block or when the gold block is broken so let’s just go back to our code and make that change so here instead of a torch we want to give them a shovel so we can start to search but what you’ll find is not there so you Can access more and what we do is we click down here on blocks and we look for this one item Okay so we’ve picked this up and we pop it over the top like so and there it is there and so all the items actually sit separately and so you Need to um put that specific little block over the top for it to work in this case we’re going to give them three shovels so we’re going to change this one to a three and then we’re going to go and hit play button to check it and I’m going to break the block And there we go I’ve got three shovels sitting in my hot bar now so we can change that up as well our last one here is to change it to give them three gold ingots so if we wanted to do that we could hit code we can Change this around as well we would just change these items so remember in this case here there it is there I can hit play on that break it and I’ve got three sitting there now as well the next one we’re going to have a looked at is called the detect Code and so what we’re going to do is we’re going to create two scenarios here we’ve kind of got a little bit of a maze but we’re going to put up a little chat message saying that either you’ve gone the wrong way or you’ve gone the right way So in this case let’s go to where it says detect one so we’re going to move over here we are here we’ve got our little MPC we’ve got this Gap here but that’s important I’m going to click on here and it says this ask us to build a code that detects A gold block two blocks below the player so it’s going to give us some gold blocks and some other Blackstone blocks to tidy up our work I’ll show you that in a second and we need to place those gold blocks on the yellow blocks below so just a Little bit of scaffolding here to make this a bit easier for us so again we want to put them down here and I’ll explain this in a second so what we’re going to do is we’re going to go back and we’re going to search for detect so let’s start writing the word detect There it is there so we’re going to pull this one across like so but the problem we have here is that it needs and of what we call our event handler now in this case I always want it to be did trying to look for and detect this Blocks so the key word there is forever and so if I search for forever which is also what we kind of call like a loop so it’s constantly looping and running that will be our event handler so I’m going to pop it up and that’s going to grab in Just like that so forever just means it’s always going to be working this code is always going to be checking now we want to check two blocks below now there’s a little default here these three zeros are your position in the world okay so there your X Y and Z position Um and so the middle one is your y it’s your up and you’re down and then the little um squiggly line in front the till sign is a means relative to where you are so in this case wherever you’re standing is always your zero but we want to check to See if there’s a gold block two blocks below you so that is minus two that always as I’m going anywhere it’s always going to look two blocks below me and essentially if it picks up or finds a gold block so let’s make that change gold block So if it’s found it’s going to run a command to say what so in this case it’s the wrong way so let’s change that over to uh saying I don’t know let’s go wrong way maybe I’ll run the wrong way go back wrong way go back oops there we go And now we’ve got to go finish and set it up and then we can test it so let’s hit play I’m going to grab my gold blocks now if you look at this we’ve got if I even if I break these out this I’m standing at zero which means This must be negative one that must be negative two okay so that’s why we wrote the negative two so let’s just replace that back fix it up again and we’re going to put our gold blocks down here so they’re now negative two blocks below and we’re going to put cover that up so We can’t see our work and essentially what we do is we want to walk over the top now because those gold blocks are two blocks below me it’s coming up saying wrong way go back okay so there’s that little message for us so I’m going to make my way back Go to the other side and essentially here I can repeat the same thing but I would have to use a different block I couldn’t use gold again because gold will always give that same message so in this case let’s think about it let’s go back to our code and what we Can do is we can grab code and duplicate it just like this but let’s use a different block we’re going to use let’s go with some let’s go with Emerald still 2 minus two blocks below but in this case um let’s write something like correct way or something you could really write Whatever you want just as long as it’s um kind of make sense to your game correct door that will do so in this case here I’m going to then grab an emerald there we go let’s place that down there and essentially I’ve got my little message there as well so that is our Detect block and basically it’s giving us those on-screen messages now next one we’re going to have a look and it gets pretty a little bit dark in here is the effects block and there are so many options here so I’m just going to pick one but you can kind of let your Imagination go wild as to what you may want to do here but essentially this maze keeps going but it gets very dark which means it makes it very difficult to actually finish the game so what we’re going to do is we’re going to give our player an effect of night vision When they climb a latter so let’s close this let’s look at our coding and what we’re going to do is we know they’re going to climb so let’s search climb and it might need so we know is that we know that that’s going to be when the player is doing Something so let’s do it this way this time let’s click player and we want this one here it says on player walk now they’re not going to be walking they’re going to be climbing so let’s change it to climb and so that will cover us that will be what will Trigger the code that we put inside here and so what we want to do is apply an effect now you can just like we’re doing before we can start writing the word effective here it is here let’s grab it and pop it in like so let’s move that over a little bit Now if we click down here we’ll see that with all the available effects will pop up so in this case what we want is this one here is night vision so I’m going to change that to night vision it’s going to apply to the nearest player we’re Going to give it a duration of 10 which is just seconds and an amplifier of one so we’re not going to change anything there if you wanted to make it shorter or stronger or longer whatever it may be you would change these numbers around so let’s click on play and what we Should find is that it’s not going to work while I’m walking but I got just enough light to see the ladder but up there it’s way too dark but when I climb the ladder night vision turns on and I’ve got 10 seconds to find my way through It’s going to be about here perfect and then it’s gone so my 10 seconds has passed but there is another ladder there so when I go to climb down that ladder the effect is going to apply again I can come around and make my way to the very end so that’s our effect Command you could play around with this and have so many different ideas as to what you want to do but that’s a nice simple way of using it with make code so let’s look at our next grouping of make code commands essentially is what I like to Think of them as we’re going to look at the summon one so in this case we’re going to use code to create an event whereby a chicken will spawn basically in the pan next to us whenever our player eats an apple okay so I’ve just kind of chosen pretty random scenarios Here now this is the position this 506 32 8 is where the chicken needs to spawn where did I get that number that is the world position so if you look at my screen on the top kind of top left it says position and so those numbers move around as I move Around that’s my x y and z now if I jump in this pen roughly I think that’s the same numbers 506 32 8. I could definitely use those numbers as well if you can’t see that you just need to hit Escape settings and then you just need to scroll down And click this show coordinates make sure it’s flipped on over to the right so anything to the right is on so what we’re going to do let’s go back and we’re going to hit C for coding and in this case we’re going to use that’s basically when something is used Um so it’s a player action for this case so we’re looking for this one on item used now we’re not using a shovel it said when we ate an Apple so we’re going to click on here and change it to an apple and then what we’re going to do is make A chicken appear now you know in Minecraft the word for making something like an animal appear is spawning so we just type in spawn there it is there it makes sense that it’s purple because it belongs in the mobs and then we’re going to pull that down And place it there now luckily for us by default because I’ve just kept this nice and simple the default one here is chicken so that one is chicken if you want to change it to one of the others you kind of just need to hover over until you find the one that you’re Looking for there’s no search function here for this one now we need to specify the position that it’s going to be at and in this case it always has this option here and these are relative positions so it means it’ll spawn at that position as to where you Are which means if I we know the middle one is our up and down which means if I wrote 10 it means the chicken would spawn 10 places or 10 blocks essentially above my head now I have a specific World position I want it to go to so what we Do is we click here on positions on our make code and then we click here on the world one because we have an exact position we want it to go in so let’s replace that so we just put it over the top gets rid of the other one and we Type those in so the MPC told us it was 506. and I’ve kind of written these down so it helps to have pen and paper doing this as well and we go eight there we go now NPC actually gave us an apple as a result so I’m going to grab this apple I’m going to start eating it and there’s my chicken okay if I eat it again there’s two chickens again keeps going three chickens so on and so forth that you could totally change that up you could also change it so that if you do something else a different animal Appears or the the options are really endless when we think about it but that’s just a nice simple example of using something and spawning something at the same time so that’s our summon let’s go on and have a look at the fill command by using Code so in this case I’ve kind of provided a little bit of a scenario we need to be able to cross this water but it’s full of Guardians so if we were in some survival mode it would be very difficult to cross this so what we’re going to do is swimming is Not an option we need to basically like build a bridge and so we’re going to use a fill code or fill command to do that now we always need something to trigger it so I’ve just decided that it’s just for humor it’s whenever we use a fishing Rod we’re not going to actually catch a guardian it just means you just have to use a rod to to do it and that might be the secret to the game is everyone thinks you might need to fish them out to get across but if you just use it if You use a fishing rod the bridge will magically appear so let’s hit C for coding and again this is going to be an on item used so because we’re going to use a fishing rod so let’s change that and scroll down a bit there we go and let’s change this to Rod so There it is there and then we’re going to do what’s called a fill command so that does sit in blocks you can of course my favorite way of doing it is just type in what you’re looking for fill there it is there we’re going to drop it in Now just like we learned before we actually need to know the space that we want to fill from so you need to know basically if I’m going to go straight across I need to know where I’m standing where I want to start and where I want to finish and they that’s where the Blocks will fill to now in this case I’m just going to hit escape to go back out because my NPC tells me so this is the positions that we want so I need to go from this first one this 504 3214 and I need my bridge to end at those now if I Just if we look at that think of that first one 504 3214 I’m pretty much it’s right there so if you look at my position um up in the top left hand corner 504 3214 this is where it’s going to start but it’s going to end on the other side And we know that because if we look our numbers are pretty much the same except the 14 becomes 24. so it’s basically 10 blocks away is what that means so I’ve got those numbers written down so I’m going to come here now we need to they are specific World positions so we Need to go position and grab the world option click on that so we need two of those and so it starts at 504 32 14. and then it ends at 504 32 4. okay so we’re going to grab that let’s grab ourselves a rod and then I’m going to imagine I’m going To fish there we go and then there’s my bridge now we could you could change that if you want to if we wanted different types of blocks um I could go let’s go back to code I just drop this down and change it to Whatever I want so if I want them to be bricks let’s go with brick slabs there we go and I use my rod again and I’ll just change okay and so now I’ve got my little bridge that I built to get me across perfect all right let’s look at this last one Here for intermediate which is title code so what I want to do is I want to create title message screen which is the big text that comes up on the screen and I kind of want this as a bit of a countdown so like a fire you know the Game is going to start in five four three two one type of situation so this one’s quite simple it just takes a lot of code because it’s repetitive and so I want this to happen when the game starts so when someone enters my game so let’s hit on code and let’s move This one up out of the way and what I’m going to do is we’re going to click on Loops because this is where it is I’m going to click on onstart so when the game starts basically and what I wanted to do is I wanted to Show a message okay oh we call them titles in the game so if you’re not sure we could search that title there it is show title and you’ve got both there you’ve got the big title and then it says subtitle that’s the little text that goes underneath it We’re gonna we’re not going to use that for this one but essentially so we might write something like you know game don’t forget as well um that you do only have the width of the screen so don’t go too crazy with what you write uh start In and then it’s going to kind of count down so for example if I duplicate this I change that to a 5. duplicate that again for the only problem I’m going to have here is that all of these are going to execute at the same time which means you’re not going To see anything but the last one so I want to put little pauses in so if I come here and I type pause here we go let’s click on that one I’m going to pop it in it’s a hundred milliseconds which is pretty quick I’m gonna just let’s just Throw an extra zero on the end that will give us a bit more time so I’m going to duplicate that as well and so we just want to pop a pause between each one so let’s let’s just keep going with these so let’s go duplicate that’ll be three two one And then we’ll either say like zero or go or something so let’s change that to a three change that to a 2 a 1 and let’s write go okay and then I just want to duplicate these so I’m just doing the same thing over and over again but all I’m doing is I’m Just slightly changing that message so it’s going to onstart it’s going to say game will start in and then it will pause five pause four pause so on and so forth so this will just run automatically because when we hit play it’s just assuming the game is starting so let’s hit play There we go game will start in five four and you get the idea that little pause is what we wanted to make sure that we can clearly each see each message all right let’s move on to Advanced so we’ve just got two sitting in this one and they are similar Um but a little bit different as well so this here is what we call our test for Block code and you can do this in command blocks I actually think it’s much easier in make code than in command blocks but let’s have a look at it so Essentially what we have here is that a cake is missing it’s hidden somewhere and we need to put it down back on the Shelf between the other two cakes a doorway is going to appear at those exact positions okay and at the end it tells us exactly where the cake needs to Be so it’s worth writing them down so we’re going to kind of take some things that we’ve already learned here around specific World positions around filling a space which we’ve already learned and the art one thing we’re going to add is we’re going to add that testing to see If there’s actually a cake sitting in that very last World position of 519 33 7. so my cake needs to go here so let’s code it out so essentially what’s going to happen is if our player successfully puts the cake here a doorway will open in this space So let’s click on code let’s scroll down a bit and like the code we did before where we were always trying to detect for Roblox this time we’re always testing for a block so a little bit different but we’re taking the same idea so let’s go forever here and what we’re Going to do is we’re going to check whether something is happening and basically if it does happen and then everything else can happen at the same time and so what we call that encoding is logic so if something will logically makes sense make it happen and so we’re setting a Condition so here in our conditions we have these if and else statements and we’re just going to use this F1 today because we’re only just checking for one thing so we’re going to grab this if and drag it out and pop it in so basically forever if something is True then make something else happen so the very first thing we wanted to check for if it’s something is true is whether the cake is sitting in the position we want it to sit in and so what we do here is in blocks because our cakes will form Part of our blocks as we look at this one here it’s called test for block out of position so let’s click on that and we’re going to put it here where it says true now I’ve written it down so I’ve written down where our specific position of our Cake needs to be which our NPC told us and so let’s go to position because we have a specific World position let’s put that in and in this case it was five one nine 33 7. and in this case it’s not grass it’s not searching for grass it’s searching for a Cake so we change that over so forever if you test for a cake at that position then what will happen the doorway will appear so in this case we’re just using what we’ve already learned which is a fill command so Phil’s we’re here in blocks so let’s click on fill we’re going to Place it in like so and again I’ve ridden those positions those exact positions that we needed so because they’re exact we grab the world ones here we go I’ve just got these the numbers for these at the moment are just from ampc so it’s five one six 32 12 and then that’s where it starts and then where we wanted it to end was five one five 33 12. perfect so essentially what it’s going to do is it’s going to check now we don’t want it to fill with grass we actually want it to fill with air tricky little block there So if the cake is placed in that spot fill this area with air now what is that area there that 5 1 6 32 12 it is essentially this little oh and that’s still running I’ll turn that off when I next go in it is this little space over here which is Um which is where the air is going to be replaced so I need to find my K there it is I know where it is because I put it there and then I’m going to come over here and I’m going to place it down and there it is it’s filled with there And so even if I just stand here in this position you’ll notice that those numbers are the same 5 1 6 32 12. and then my other position which is here because I wanted to I basically want to fill from this corner up to this corner is where I’ve got those two Numbers from so essentially let’s move on and look at our very last one which is very similar except in this case I want to test for blocks not just one block I want to test for two so multiple blocks so in this case we’re going to we need to feed the Horses we need to put two blocks of hay down and then what will happen is that we will be teleported to the very last stage to finish off our little coding experience here so what we’re going to do is again we hit our c for coding And we’re going to come in and do just like we were doing before so a lot of this stays the same we’ll even kind of just keep that there so we can see it so we’re gonna be forever testing for this hay that we’re going to feed our horses And again we’re going to use some logic and a condition so you can let’s grab the if then condition so if something happens if so if we basically find this hay then we can take the player to the end of the game but in this case it’s not just like we Had one cake now we have two barrels of hay so in our logic what we can do is add in some what we call Boolean code okay so here you can see this and option and we’ve got all options as well and so there are key ones so what I want to do Is I want to grab the and and I want to put it here in the true and that just essentially means that I can test for two things so test for one block of hay and another block of hay and you could expand this out it could Be two three four type you know actually whatever how many you wanted you don’t want to go too crazy but essentially what I’m going to do then is just like what we learned before so then I’m going to go test for this two two hey there we go And then I’m going to go my specific World position now this number again is just taking it from the MVC so in these ones the MPC kind of helps you out and gives you the numbers that you need so it is 535 32 23 But there’s two okay so what I do is I duplicate this one I bring it over and essentially it’s just testing for the block next to it because you put the two hay bales side by side so it just means that one of these numbers is going to change and in This case it’s this one it’s just the next one over and I’m going to jump out and show you what I mean by that so 35 and 36. so let’s jump out because I’ve actually got them in here and you know I’m going to quickly fix that because that will end up Annoying me there it is let’s just pull that bit of code out so it doesn’t keep running on us so remember 35 and 36 that’s what we were checking for now if you watched my coordinates this is where you have to put the hay on these two yellow tiles There’s 535 so my position we’re looking at my position numbers there’s 535 if I walk over to that one that’s 536. so that that’s my two positions that’s where those two numbers have come from now what we want to do is teleport um the player if they successfully Achieve this to the end of the game so here in player you’re going to teleport them to an exact World position so we go back to position and click on world and again this will make more sense when we actually run it because you’ll see the position I chose but you could find Any world position the easiest way to pick up on to find your world position is just to go stand exactly where you want it to happen and write those numbers down so it’s five three six it’s 32 4 which by those numbers means it’s just around the corner Perfect now what I’m actually going to do is I’m going to we might think that’s finished but I’m going to show you that this isn’t there’s going to be a problem with this something we would need to debug and so essentially in my game here I’ve got some hay hidden in the shed Which the player would need to find I’m just going to speed things up a bit by just grabbing some and so put the so it’s tested it’s oh it’s it’s also sells the first condition has been met perfectly second condition has been met there we go Now I’m at the end but watch what happens when I try to walk away I keep getting teleported back and you can see that running and the reason for that is it’s constantly testing that space and there’s always hay there so I can actually never Escape So there’s a nice little way of fixing this so what we’re going to do is we’re going to go back to our code we just we’ll need to just pull this out for a second and that will stop that from happening let’s punch a wall it’s not too Secretive to be honest but there we go it’s just in there hidden away and so what we’re going to do is we’re going to have to get rid of these there we go and what wait because what’s what we want to happen is we want to be Teleported and then we want them to go we want them to disappear and so we’re just going to take another skill that we’ve learned and so we’re going to fill that space with air so let’s pop this back in now and so what’s going to happen after we Teleport is we’re going to go fill with air those exact same spaces so this is really easy to do because what you do is you click here we want to fill that space so let’s just duplicate it and I want to fill this space as well And duplicate it and so what will happen is that I’ll put the hay down I’ll be teleported and we won’t see it happen because the player will already get teleported then the hay will get replaced with air and the code will stop running so let’s hit play Let’s go hey and the second hay and there we go you can see I can kind of freely move around if I go back out what you’ll notice is the hay is actually gone to kind of reset itself which will stop that little bug from happening All right so that is it for these um don’t forget you can download these you can also get the one note that goes along with it for teaching um I hope you have a bit of fun I enjoy using Bank codes for game design and we will see you again soon foreign Video Information
This video, titled ‘Using MakeCode for Game Design – Minecraft Education Edition’, was uploaded by Andy and Richo – Digital Innovation for Education on 2023-01-12 02:19:36. It has garnered 2192 views and 18 likes. The duration of the video is 00:36:29 or 2189 seconds.
Resources 👉 https://bit.ly/MinecraftCodingCards
Learn how to use Microsoft MakeCode to code gaming experiences in Minecraft Education Edition.
Nathan Richards will take you through a series of different scenarios where you can use the build and design of your own game.
Give Code: 0:53 Detect Code 5:16 Effect Code 10:28 Summon Code 13:11 Fill Code 16:54 Title Code 20:49 Test for Block Code 23:58 Test for Blocks Code 29:17
Subscribe 👉 https://bit.ly/3ndUCuH Resources 📚 https://www.digitalrichards.com/minecraftgamedesign
We are an unofficial and independent video and resource creator.
We specialise in developing resources for OneNote Class Notebook for schools, teachers and students.
Minecraft is one of the most powerful game-based learning software available to schools today. The perfect part of Minecraft is that students already come with the skills and knowledge of the game. If they don’t, it is highly likely that another student with happily support their peer. Many teachers can successfully implement the use of Minecraft Education Edition with minimal, if not no, experience with the game. All of the videos in this channel are designed to help support teachers in successfully using Minecraft Education Edition. Join Nathan Richards as we explore how Minecraft Education Edition can transform learning in your classroom.