Simple Maze Generation | Scratch Tutorial
Вставка
- Опубліковано 16 чер 2024
- Ever wondered how to generate a random maze? Today you can code with me a simple project in Scratch that draws a new maze every time. You'll be amazed how easy it is!
We cover:
• random maze drawing using tiles and stamping
• prevent corridor overlap
• routing around objects
• backtracking
• recursive scripts using custom blocks
• variable size and length of passageways
• adding a simple user controlled character to gamify the project!
Studio on Scratch - scratch.mit.edu/studios/29651...
Hope you enjoy!!! And Scratch On!
🚀 Boost Your Creativity with Griffpatch
The Griffpatch Academy will take you from "Gamer to Game Creator"
Learn more at 👉 griffpatch.academy 👈
😺 Scratch was developed by the Lifelong Kindergarten Group at the MIT Media Lab. See scratch.mit.edu
9:41 "so how do we get out of this one? the answer is we...don't."
that's a good mindset!
We dont is my answer on how to do the black border since lets just make the tile and border nearly the same colour and make it just reset if you touch the border
Who Would EVER dislike griffpatch's tutorials... Griffpatch is the god of Scratch and doesn't deserved to be disliked on his videos
Maybe it wasn't what they were hoping, or they don't do Scratch
@@griffpatch oh ok griffpatch
@@griffpatch It might not be what im hoping for, but I always come in to check it out!
or they are just haters
@@griffpatch or they are just haters
I love how you show us how to put the codes together easiliy and in a simple way. I didn’t know how to code that much but when I started to watch your tutorials, I started to understand how things work.
I've programmed a maze generator 2 days ago in JS, still working on it in order to avoid repetitive-looking patterns... my code for it is a bit complicated. After watching your video, I realized that the process of creating a maze is actually simpler than I made it to be!
Thanks for creating these amazing tutorials!
Also, 21:35 you blew my mind when you placed the key pressed block inside an operator 🤯 I didn't know that was possible
Yay :) I love simple solutions to complex looking problems
@@griffpatch Yeah! Me Too
"That's the neat part, you don't."
??????????????????????????????
I'm not at all into programming, and I haven't even looked at Scratch in a decade... but I sat through the whole video because wow it's interesting how you can use the simplest code to do things like this, and griff has a voice that's very easy to listen to.
Wow, thanks! :D
𝘔𝘦 𝘵𝘰
@Sloth man They're not wrong
13:17
me too
Damnnn. You did maze generation with just a few chunks of blocks, with backtracking! The coolest part was that you could add shapes that the maze avoids, can't imagine how i would go about achieving that with lists and other algorithms. Good video!
I still don't understand how the backtracking works
wait, i think i know how he did it
I can imagine it. I'm using this tutoiral as a reference for my zombie/shooter game. It uses a grid of tiles (also borrowed from griffpatches tutoirals).
I haven't used Scratch in literally years but I remember you being such a massive inspiration for me, no idea how you ended up in my YT recommendations lmao
You are the genius one in the universe who can do everything possible in coding.
You make me popular in my school through this simple maze trick.
This will fit perfectly with the pathfinding!
I litteraly tred that.
Spoiler: I have been here tryna make it work, only got 11 path directions on screen.
@@Nersaurus Probably it was the size
Yeah!
I didn’t read the other comments
Thats what i was thinking
It would just make a zero player game 🤣🤣🤣
Pathfinding tutorial: Let’s give Scratch Cat lots of love let apples!
Maze generation: We’ll begin by deleting Sprite1...
rip scratch cat number 29481949 2021 - 2021 😔
Well... You could connect the two together for an endless maze generator and solver maybe! Or for example a game with random mazes and enemies following you pathfinding 😀
haha lol
🤣
pathfinding: lets make some cats in a maze and make they find the apple
maze generation: lets delete the cat and make the maze
pathfinding generator: so lets delete the cat and make him find the apple...
So this dude just explained the concept of randomized depth-first search algorithm for maze generation without even mentioning randomized depth-first search algorithm for maze generation once in this video? You just earned a new subscriber.
this was really useful because it really helped me be able to make the backroom when making the back rooms inside of scratch
griffpatch: Simple Maze Generation Tutorial
Me: *Dies in complexity*
thats too true
Also me: *wait this is easy*
"It's really quite simple"
True
this is in the quick and fun playlist its 25 mins long
Who else thinks watching griffpatch play games with commentary is the best thing ever
Me
Stoopid!! The answer is :نحت غه لا تنم
الّ تَ منخ كٍقهقع قبخو ج1ميظرط
@@parkergreatgamer7837 نعم؟
me
This is honestly one of the most insane things I’ve seen on scratch.
This was AMAZING!!! u taught it like it was so simple!! Normally for me, i draw my owns maps but this one is 1000 times better!
same i draw them myself
So cool!
Everything is explained very well and is easy to understand!
New scratchers could definitely learn from these videos, which is another reason why they are good!
Now time for maze generation with pathfinding!
can you combine pathfinding with this plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
@Aether 1208, yes, I agree but for me, there are many bugs. My PC is older, and so these types of tutorials just don't work for me. I wish everything would turn out how it shows, and I am not saying that this problem is Griffpatch's fault, but I really wish it could work on slower/old PCs. But when looking at others when searching for things similar on Scratch, I saw that everything went nice and smoothly and the code was beautiful. Even though it does not work on my PC, it still looks like it was easy to understand, easy to make, and works as intended. Nice, but wish I could be a part of it.
as always, great video. I haven't used scratch in a long time but I'm always impressed at the clever solutions you put in place to avoid the constraints and limitations of scratch, while keeping the videos understandable for everyone.
This was extremely easier than I expected and works great! Thanks for the wonderful tutorial!
The way this guy thinks and codes is just so fluent he started from a chunk then used pen to make a full random maze with back tracking from 3 sprites. This guys out of anyone’s scratch league
The genius of this is how simple yet well-made it is, like how at the end you could just add in shapes to the bounds and the maze perfectly dealed with it. These are just the best, keep up the great work!
Yeah, I love the naturally emergent fun you can get from coding! :D
@@griffpatch Your the best at scratch how did you learn these stuff? WOW
There are 5 savages in the world who disliked griffpatch's video
yes.
Make that 6. And no, I'm not one of those savages.
@@Luckyshape same bro it's sick they need a mental hospital I don't even think they deserve a mental hospital 😁😁
@@yomamafataf ok
How did u know
you may have missed this but combining this "random maze generator" with your "3d raycasting" tutorial can make a fully 3D maze exploring game!
Thank you so much, you helped me to do the programming of my school! Now, my teacher is not going to kill me ;)❤
I have been waiting so long for this. Maze generation always made my brain wrinkle and I can't wait to learn how it works.
@Ljubo Velicanin Same
I love the animation that griffpatch puts into his videos.
try this set of properties:
-set tilesize to 30
-start at x and y each 15 instead of 0
-remove the maze-bounds-sprite and use [touch (edges)] instead of [touch (maze-bounds)]
You get a maze, that fills your game-screen perfectly with 16 x 12 tiles of corridors
This was exactly what I wanted to do today, and it popped up in my recommendation, and I'm glad it did 😊
Thanks for the Tutorial i actually needed this for a puzzle game.👍
Keep up the good work!
Griffpatch opens up my mind to a whole new realm of possibilities! Great job, griffpatch!
I agree.
Same
I love how the walls formated on their own; super cool!
Wow, I would have never imagined how to make mazes like this! I thought that you needed to code up things like pathfinding for this, but you made it clear on how to make it simply! I bet you could make a scratch messenger with all of your scratch knowledge. I guess I can now make an infinite randomly generated maze game with a level counter which you showed in a tutorial how to make
Wow I’ve never seen a costume limit in scratch. Keep up the great work!
Wooo! I’ve been seeing these all over scratch, they are so cool! I’ve wondered how to make them
I love your videos and I am learning a lot from you!!!
sometimes when i watch these videos i get that feeling where its just too good to be true! i never thought i could make a random maze in scratch wow
He he, no you can do it too :D
the process:
me: making a complicated mechanic that i made 300 blocks for, and it still doesn't work
me: searches up a tutorial
griffpatch: does the exact same thing in 4 lines
me, looking through the code: WHY DIDN'T I DO THAT
aaaah
relatable
gotta give this guys some respect
Your pfp says it all
#relatable
#relatable
Bruh
I always would consider such things really hard to make until Griffpatch makes a tutorial about it
And then I think of them as harder cuz I know I can never make my code as clean as his :P Seriously I end up with big blocks of redundant code and tons of When 🏳️ Clicked > Forever > If / then. Still just begging to wrap my head around custom blocks lol. It's fine tho, it's all part of learning process and I genuinely really enjoy coding with Scratch!
If griff doesn't do it I am like :|
That was such a cool tutorial thank you very much. To be honest Im not that good with Scratch but your videos are helping me fantastically. Thank you
It was the first griffpatch tutorial I tried to follow but did not finish. But today I have finally done this. In the meantime, I have some of your other awesome tutorials.
👍👍👍😃😃
Woah! That's actually insane the generator, I gotta try this out
Wow! The possibilities at the end of this .... INFINITE!!! I already have an idea!
I didn’t even code while doing this i just watched this because it’s interesting! Griffpatch can make coding so fun!
THANK YOU SO MUCH FOR THIS TUTORIAL!!! I MADE IT AND IT LOOKED AWSOME!!
griffpatch: make and x
me: trying to make a perfect x for 15 minutes
So you were like this?: ua-cam.com/video/6oMUiZXYQC4/v-deo.html
Just make a line, hold shift, turn it to the left (45 degrees), snap it to the center, then click it and hold alt (it will make a duplicate), then just hold shift and turn it to the right two times (90 degrees), snap it to the center. Easy
Me too xd
Wow, I am not sure what I would do without you!!!!!!😀
I'm very thankful to have this tutorial, thank you.
I havent made one but this is amazing! I'm amazed :)
i can't wait to add pathfinding to this. i might also use some of these tile scripts to remaster my old snake game.
Great video! I still don't understand why you don't have a million subscribers, these videos are simple and understandable!
I didnt know what to do of your awesome videos so I subbed.
Thank you! This tutorial was extremely useful! 🤩
I cant thank you enough for this tutorial! Thank you so muchh!
Griffpatch: You have to be quite precise for this
Me: *Drawing Precisely Intensifies*
Yay! More scratch tutorials!
Thankyou for the tutorial. I have to create a scratch game for a course I am doing and I was just trying to see what it is capable of which you have demonstrated quite well.
Excellent. Very informative and well-explained.
"for now, we'll leave run without screen refresh clear"
impossible
"for now, we'll leave run without screen refresh clear"
wait... what?
lol that's what i thought too
you heard him that recursive script with screen refresh could melt and burn your pc
@@miguelbaltazar7606 😳👁️👄👁️
Wow! This will go very well with the AI path-finding script!! :D
AI makes its way through mazes lol
Imagine this, with grid patterns, with path finding
it would literally be insane
with the 3d raycaster
I love the concept of a chance of doing something just by using random block
18:34 Griffpatch 2021 - WhooHooo!
Henry!
@@svshhsbs hi!
@@dubsisthegoat48 how'd u get so famous?
I really needed this Thanks!
*Again*
*Again*
Awesome! Thanks for helping me out :)
I recently made my own list driven random maze generator on scratch. It does the same recursive backtracking algorithm yours does, but it draws the maze by "erasing" part of a grid line rather than stamping a bunch of objects. My mazes can get quite big, up to 238 by 178 in size.
I’m a normal human,
I see a griffpatch vid,
I click.
It's been 40 seconds since video release and there are already 60 views!! We all really do wait for so long for a new tutorial :D
that's griffpatch for u :p
@PaddlerGames yes
@PaddlerGames one month for 150,000 viesw
Fits perfectly with both pathfinding and pathfinding with grids.
This tutorial was amazing for me! I am currently making a backrooms game using this tutorial and your 3D walls tutorial too! This tutorial makes it so much easier to make this!
Does it work? Wouldnt the different pen settings clash?
griffpatch: deletes scratch cat
me: noooooooo i want my cat to get apples
The player can be the scratch cat trying to get to the apple... BUT there's a twist... literally. The scratch cat has to solve the maze first before getting to the apple. Maybe you can add your ideas for enemies or obstacles
@MeZa Phius r/whooosh
@@TheRealVbros r / w h o o o s h
@MeZa Phius brUh
@MeZa Phius umm
Game logic? It can be anything a cat can eat lmao
Hi griffpatch, can you make a tutorial on pen? I've seen many pen projects you made and I absolutely love them!
@Firoz Khan they dint SAY they were
L
@Firoz Khan since they arnt griffpatch
for a sec i thought it was not but i didnt give up and i still followed your tutor and then it work so thank you griffpatch
pretty cool! I've never used this programming software/language before, but I think I might give it a go.
Website*
Everything is very well explained but I have a question, why do we use an object as a edge and not the border itself?
I played around for a while with that, We would have had to do some trickery to get around the issue of the sprites going off screen temporarily, and that was throwing things off... Also, we couldn't do the end part of the video where we can use other shapes to make our mazes more exciting!
@@griffpatch Wow, that really makes sense!
I didn't think on that
@@oyjuk9192 No, I wouldn't have too until I was working on the problem :D
@@griffpatch next do pathfinding in a maze lol
No screen refresh is a powerful tool I didn't knew about before watching your videos
While i was watching this video, this gave me an idea to make a maze just like you!
9:41 "so how do we get out of this one? the answer is we...don't." I started laughing but then you started explaining why I started to look and stop laughing
thanks for posting on my birthday!
Happy birthday!
Happy Birthday!
Happy birthday!
Happy Birthday!
Happy birthday
Really helpful! Congratulations! I'll make a maze game if I have sufficient time! :)
Im going to make this with multiple of the bounds and multiplayer tysm for the tutorial griffpatch i will credit you when i finish it! :D
thank u soooo much for this vid it works so nice!!
We need multiple tutorials about how to make rpg!!! That would be epic!
scratch cat be like: but i thought we were friends :(
Yeah lol =P
Thank you for this video I made a project based off this! great vid 10/10 would watch again
I dont even use scratch anymore (I now use python, c++, c#) but I still watch these tutorials for ideas. Just because scratch is simple, doesn't mean it's bad.
I just made mine! this tutorial is helpful!
Great!
If you shared it can you send the link?
@@jaredteoh730lo
I’m all ready thinking about how to combine this with the pathfinding project 🤣
Yeah same
I think there will to clones if you use the same method
this was posted 8 days before my birthday, THE PERFECT EARLY GIFT
I plan on using this for my rouge-like game, thanks!
"for now, we'll leave run without screen refresh clear"
wait... *_thats illegal_*
:PPPPP I can't wait to get started but I have to rush some of my homework tonight
whelp, better finish it faster!
same lel
Im gonna use this along with the ray casting tutorial in order to make a 3d maze game, both with an infinite mode (this maze generation) and some other mode with levels made by hand, maybe an apocalypse mode or smth with sprites that you have to click before they reach you. Might have to separate modes into separate scratch projects tho
Dude thank you for this because of you i was able to make one with coding not blocks but code in another game just cause of that idea thanks man
Roblox kid get a life lolll
at 11:44 why the maze will stop at the beginning? It seems looping and never end.
If no direction way can find. It will keep Move "0 - Tile" means backward. Then it will non stop??? But why will stop at beginning?
You have to trace which scratch code blocks the program has run through. If it goes into one custom block, and then into another... when the other has finished it will return to where it left off in the previous scratch block. This way, it will not run forever, it will only go back as many times as it went forward in the first place... and in the end every movement will have been undone.
@@griffpatch many thanks. Let me think about it
@@griffpatch thats really confusing :D but I sorta get it
@@awesomegamer-cv4zf I follow the step. I guess at the last step. It have no place can run, then die end and complete the loop.
@@griffpatch can you do a Tower Defense game or FNF
Hi, griffpatch! I've encountered a bug in the tile scrolling platformer series. Goombas are killed if Mario is moving downwards and are touching him, *regardless of where Mario is relative to the goomba.*
That's also a bug in the original SMB, lol
You are basically making me pass my scratch exams
Thanks, it really helped me!
Without you, half of my projects would be discontinued lol
Edit: Autocorrect made a spelling mistake.
Roblox kid get a life lolll cringe
it would be so cool if you could combine this with raycasting, but if you kept the erase all in the raycaster it breaks but if you remove it it still breaks
I actually made one!
Name: a very cool 3D maze generator
@@arandompersonontheinternet8127 Can you send a link to it? I can't find it on scratch
@@c_sea1n I sadly lost my account with that game, but, I still use scratch
This combined with the pathfinding alg. and automation would make for a good screen saver
Wow, this was made 4 days before my birthday, rock on!