Code Wordle in Scratch 3.0 || Tutorial ๐Ÿ” 

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome back to another squad tutorial video today i will be making a virtual game in scratch so this is the official world game and in case you don't know what that is it's a random five-letter word guessing game so you guess a five-letter word like here i guessed crane and you have six chances to do so there are three colors which your block can be when you enter the answer it can either be correct which is green incorrect which is gray and misplaced which is yellow so let me just try out a word here i'm just going to say like metro here and then like that and as you can see i have some incorrect and some misplaced ones and this is the one we're going to do by the end of this video so we have the blocks here and our goal i'm only putting it there so we can test it out i'll go this antic and we're also going to type antique and everything is correct and we win and we can click to start over and now the gold is china and we'll just do i don't know apple and as you can see now it is incorrect and misplaced so let's just start doing that here we've got two sprites one is called main and one is called wind slash loose screen in wind slash loose screen you've got of course a windscreen and a loose screen we've also got a background it's just a white screen with name wordle on it in main we've got four blocks one is blank one is correct one is incorrect and one is misplaced and each of these four costumes have their own color we also have all the letters of the alphabet with the names so like here we've got uppercase a and then uppercase a is also what it looks like and we've also got lowercase a and uppercase a is still what it looks like that's because we don't want this to be case sensitive okay so now we can just get on to coding so the first thing we will do is go to when clicked and then we are going to hide then we are going to make a new custom block and call it make word list and then make it run without screen refresh okay so i'm just going to drag it over here under this height we're going to make with the word list and then we're going to make two new variables one is called counter the other is called words we also have two lists one is called word the other is called words list okay so what we're going to do first is we're going to set our counter to and we're going to delete all of the words list then we're going to set our words to so in the description of this video i have a list of over 1500 words you just need to do command c or command v so copy and then command v or control v to paste and here we have the words we're just going to scroll over back to our page oh that's a lot of words so we have the page now now we're going to get a repeat until block so repeat until counter is bigger than length of words so it's going to repeat until every letter is counted and then it is going to stop below this we're just going to delete our word and get out repeat five times because that's how many letters a word has so repeat five times add letter so in operators and letter counter of words we can just duplicate that from above oops and then we're going to add that to word and then we are going to change our counter by one get another change counter by one and put that under this loop then we are going to set or not add word to words list so let me explain what happened here so it's going to repeat until we have all of this and it's going to repeat five times so for the length of our every word is going to repeat this first it is going to do because remember counters one so letter one of words which is r then it is going to do change counter by one and repeat so now it's going to do letter two of words which is e and it continues five times this is going to change counter by one once more because of the space here and then it's going to add what we did here to our words list and yeah that should work now so we are going to hide everything except for the words list right now and click the green flag and as you can see we have 1573 words and they're all five letter all of them make sense like here we've got ideal seas left block and yeah and now we can go on to the next part of our program okay so now we're going to go back to our normal sprites so here and we're going to code the rest of it so forever we are going to make a new variable now goal and goal is going to be like the correct answer so we're going to set our goal 2 then we'll go to list item [Music] and then operators pick random 1 2 the length of the list and this list should be the words list so it's just going to pick a random word out of the words list okay after we have done this we are going to make a new block and call it print empty blocks or you can also call it render empty blocks let's just do that here okay and under this we're going to say print the empty blocks so now we're going to define the print empty blocks what we are going to do is we are going to make a new variable and call it block id global like that and it's going to be for all sprites then we're going to make a new one and call that one row okay now we're going to set our block id global to zero and we are going to switch our costume to blank so if you remember correctly this is blank now after we switch our costume to blank we are going to set our row to one and then we're going to repeat five times and around this we're going to repeat six times so five times this way and six times this way okay so now we're going to say go to x i'm going to say minus 70 but you can change that if you want and y we're going to do some calculations here so operators and minus and plus so we're going to go to x minus 70 y we're going to say 125 minus the row times or yeah let's just replace this four at times 125 minus row times 35 and under our repeat five we're going to say change row by one so all the six times is going to repeat this this is going to be different so in the repeat five times we're going to say create a clone of myself and then change the block id global by one and then we're going to change our x position by 35 so this is going to do the y position and this is going to do the x position for us and all of the cloning can be in here and let's just do when i start as a clone show because if you remember before we did hide in the one clicked and when we are go after we are going to show we are going to say set and then make a new variable and call it block id and this is for this right only which also means for this clone only and that's important so we're going to set our block id to our block id global and the block id is going to be different for different blocks every time and i think now we can just click the green flag and watch and yeah you can see the blocks appear now and yeah it looks pretty good so now we can move on to the next part of our program okay so now once again we will return to the one clicked code and we are going to code some more so we are going to make three new variables one is named points the other is named tries and the last one is named yes okay so get a set block out and duplicate three times and print that under the print block now we are going to say set points to zero set my tries to run and then i'm just going to set my guess to blank like that and then i'm going to go to repeat until block out and i'm going to repeat until so i got an ore block and two equals blocks and yeah we're going to repeat until um points equals 5 so we got all the letters right or tries equals seven which means we never got it right so this one's one and this one is loose then we're going to go back to control another repeat until block and we're going to say if word list where is word list here repeat until words list contains your guess so guess is just what you guessed or your answer now i'm going to go to sensing and get out there ask what's your name and wait and we're just going to ask nothing and wait get the answer block out and now we're going to set our guess to answer so if our answer is in our words list it is going to move on to the next part of the code else it will just ask again until we get an answer that is in the words list so in the next part of our code which is under here we will say set our counter to 1 and then set our points to zero then we are going to repeat this five times we are going to make a new variable and it is going to be named letter so we are going to set our letter to and then go back to operators letter counter of answer we can just duplicate this from up here and below this we're going to get out an if statement so if letter equals and then if letter equals the letter counter of goal i am going to change our points by one okay so basically it's going to get out every letter of this of the word and so our answer that we there's in our words list and then if the letter is also in the goal then we're going to change our points by one and under this we have to say change our counter by one so under this but we can also be incorrect and it can also be misplaced so we're going to get our two if then else blocks and put one inside the other and if so if put this in here and then change points by one okay so [Music] we're going to put this back here if the goal contains yeah here if the goal contains the letter then we're just going to add the comment here for later it's going to be misplaced else it is going to be incorrect let's just try it out so it's going to ask a question and let's just type in some gibberish and it will come back as nothing and we will have to ask again because that was not a valid word and let's do a valid word now like let's say i know delay and yeah it goes away now okay so now on to what goes in these two so now we're going to make a new custom block and we are going to call it set block to add an input and it's going to be called costume and then click ok so we're going to use this three times here the first time it's here we're going to say set block to correct which is the costume name here and then duplicate set block to incorrect which is also a costume name and then we're going to set our block to miss placed which is also a costume name we're going to put that there and that there so we still haven't coded this custom block though so let's just do it so first we're going to set our block id global to we're going to do some quick math here we're going to add a minus a times and a plus and it's going to look like this put that in there at the end there should be counter and we're going to do tries so tries minus one [Music] times five and if we go back here it's going to change our counter by one so yeah it's going to change every time then we are going to make a new variable and call it block status it's going to be for all sprites we're going to say set block status to costume and then we're going to broadcast change block okay so now we are going to code what happens when you receive change block so when i receive change block if my block id is equal to the block id global it is going to switch its costume to the block status and if you remember remembered correctly each clone has a block id and the block id global is always changing and block status is costume and costume is here so yeah let's just see if this works uh no actually we'll just code the second custom block after this so the second one is called rightward and it's what its name is it's just going to write the word on screen so after it's it changes its counter by one and after this loop we're going to say right word now we are going to place this in the repeat 5 and also put this right word and repeat 5 times then we are going to change our tries by one and set our guess just duplicate this so now we're going to set our guess to blank and yeah now comes the last code of our script here it's going to be if then else so if our points equals 5 i'm going to broadcast win and else i am going to broadcast lose so like this okay after this we are going to wait until our mouse is down and then we are going to broadcast another message and this time it will be called hide and yeah so now we we need to define right through it so it's hiding behind that block there and yeah let's just define it i'm gonna put it over here next to the others so this is going to be very similar to our other block here so the print empty blocks so we're just going to copy this and put it down here we don't need this repeat six times because it's only going to repeat five times we're going to do the same thing here except instead of row we're going to say tries and we'll make a new variable and call it column like this and we're going to set our column to 1 and then repeat 5 times we are going to switch our costume to letter column of guess like this then we are going to create a clone of it myself change x by 35 and put this up here change our column by one okay and we've got that down so i'm just gonna hide everything now we don't need exceptional goal for testing reasons and yeah let's just try that out now it comes and the goal is left and we'll do laugh and yeah as you can see the right word is working but the set block too is not working so let's just go fix that okay so here in the set block to costume when it says tries minus one times five plus counter just do tries minus one and then put this times five and now it should work oh yeah and then plus counter okay so now when we press donut like it says here yeah it works so all of these are correct and if we do something else like this one is serv we'll say apple and yeah these are incorrect and this one is correct and there can also be semi-correct ones like this one is haki and we'll do apple and the a is misplaced and the others are wrong so that actually works really well and all we need to do is the wind slash loose screen and that's actually really easy we'll do when clicked go to x0 y0 and it will hide also bring out the show block for later now now say when i receive lose and then duplicate to when i receive win we're going to do both for both of them show and then they're going to go to the front layer but before they do this they're going to wait 0.5 seconds so the text can appear okay and yeah and i'm going to say when i receive hide i'm going to hide so let's just try this out now we have this and we can just type something and it says sure and i lose well that's because i haven't switched the costumes yet so when i receive blue switch costume to lose and when i receive win i'm going to switch costume to win and put the 0.5 seconds before these so like that now it is bored and i will click board and i win and i click and they start over with another goal now this time i'll try out the losing feature i'm going to do apple and then again apple just going to repeat this and i can lose so but you might have noticed a glitch with the word here and that is actually really easy to fix so here in right road we'll just remove this change block id global by one and now it will work so let's just see this just testing it out apple and then apple again and yeah it works so we have successfully made a world clone in scratch with the misplacements the letters the blocks everything okay so that's the end of my tutorial thanks for watching guys please hit the like subscribe and the notification bell so you don't miss another video bye
Info
Channel: The STEAMist
Views: 12,180
Rating: undefined out of 5
Keywords: how to make wordle in scratch, wordle clone, wordle, make wordle in scratch, infinite wordle, TheSTEAMist, wordle clone scratch, make game in scratch, how to scratch, wordle scratch, scratch 3.0 tutorial, word game scratch 3.0, word game scratch tutorial, wordle in scratch, create game in scratch, the steamist, thesteamist, make game in scratch 3.0
Id: w1h-oifqziM
Channel Id: undefined
Length: 31min 51sec (1911 seconds)
Published: Wed Feb 09 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.