Tile Scrolling Platformer | 3. Tile Collisions
Вставка
- Опубліковано 5 жов 2024
- How to create a tiled scrolling platformer in scratch - part 3
Games with their level's stored as a grid of tiles are very fast at detecting collisions, what's more they can also work for collisions off screen which is exactly what we need for creating better enemies, and better games. Today we will look at how these tile collisions work.
👉 Next Episode - Part 4 - Platforming Scripts
• Tile Scrolling Platfor...
🐱 Scratch Starter Project Game Assets
scratch.mit.ed...
👀 Playlist of all Tile Scrolling Platformer Episodes
• Griffpatch's Tile Scro...
🚀 Boost Your Creativity with Griffpatch
The Griffpatch Academy will take you from "Gamer to Game Creator"
Learn more at 👉 griffpatch.aca... 👈
😺 Scratch was developed by the Lifelong Kindergarten Group at the MIT Media Lab. See scratch.mit.edu
In this tutorial we will learn how to:
get Mario in the game
control Mario with the keyboard
scroll the level by having the camera track Mario
detect point collisions with tiles
resolve / fix collisions
introduce basic platforming scripts
fix collisions with height
improve collision resolution with maths using mod
I have used this very technique to create Paper Minecraft, Geometry Dash, Scratchnapped, Epic Ninja, Turrican 2, Appel and so many more games. Hopefully you will find this tutorial easy to follow and helpful.
#Scratch #Scratch3 #Scrolling #tile #tilemap #map #Game #Platformer #Tutorial #griffpatch
0:05 mario's moonwalk looks so majestic!
I just opened youtube to listen to some music in the background but then saw this video. I imediatly knew what to do.
I recommend this game in Scratch
@@SumRandomDewd Ikr
i know what u were gonna do!
Same here I love scratch coding because of him
In the background of What?
2:40 rare footage of griffpatch not using run without screen refresh
(epic tutorial by the way!)
good one
good one
correct bro
There is just nothing else on UA-cam as helpful as your channel!
Thanks for taking so much time on scratch and doing tutorials on UA-cam!
hi griffpatch! i know you've seen a comment like this a billion times already but i just really want to thank you for making this tutorial series and the other tutorial series as well! not only for me, but for future aspiring scratchers who want to make games as well. your formatting, energetic voice and exciting personality really keeps me engaged. it kind of reminds me of a time that i taught my ict class how to do something in scratch in grade 8 because i was really ahead of everyone else and i was really excited to share my knowledge, so i recognize that sort of energy in you as well. anyway, i don't want to ramble on for too long. you're a great inspiration to us all and again thank you for everything!!
~ hailey
My pleasure :) thanks for that!
@@griffpatch can you make Mario 3d world next plz
@@Gorilla_Tubelol bro
@@Gorilla_Tube that too far
never
The fact that this man only looked at the source code for scratch and then became a mastermind of all things scratch is mind blowing :O
nobody can wait for such a helpfull series like this!
True
Invictus man tru
Ues
i want to do something like this but when i try to do anything i miss always
yousef1342 my code breaks
I don't know what most of us Scratchers would do if not for people like griffpatch.
I'm a huge fan!
yeah!
Me too!
in 2023 october, i will create video: scratch --> minecraft --> java.
Wow two 20+ minute long videos in as many weeks, griffpatch is giving us a real treat!
First-
@@christmasgamer6510nobody asked
@@tatertotboi nobody asked you to ask
@@christmasgamer6510 nobody asked you to say nobody asked you to ask
@@chococookie7158 yeah you're right... but I'm the one who asked. Since you also said "nobody asked you to ask," you are technically asking too.
I appreciate leaving in the sections of initial code that ends up having to be adjusted. It's very helpful to see just where the limitations of certain approaches are. Then we can see the problem solving work its magic rather than just get the final "perfect" code handed to us!
In the wise words of griffpatch, "Make sure to tick run without screen refresh"
lol
@Lets_Go235 lol
Griffpatch, I thought I knew scratch up and down, but thanks to you I now know it even more!
This is my list for the next tutorials:
- Player animations
- Enemies
- Half slabs and slopes
- special tiles (coins, checkpoints, ect)
What about the level designer... :D
@@griffpatch Oh yeah that too :D
I know I’m late but can u make a tutorial on how each thing works (for example can u explain how mod works)
(a MOD b) = the remainder after dividing a by b. So 32 / 32 = 1 remainder 0, and 34 / 32 - 1 remainder 2. The cool thing about this is that as we can use division to find the tile we are touching, and mod (remainder) to know how far through we were.
@@griffpatch thank you I never new how mod worked, that could be very useful for some of my games
Omg I just noticed u pinned my comment!!!!
@@SmileyZGuy Yeah I usually use mods for sprite animations, to get easily from an animation to another, when you code some kind of animated platformer.
@@bulbasaur4943 modulus and floor is really helpful
I am making a platformer with a 16x16 pixel art. I have reached this part and feel so glad I was able to squash some bugs to make it fit.
I had to mix up the normal platformer tutorial collision with the tile collision for it to work but everything was fine, thank you for always making tutorials of what people most need.
Such an informative and helpful guide!! I've made tile games in the past, but the speed was limited due to constant looping through a tile list to find and resolve collisions. I'm glad you showed some great ways to do that and other things efficiently. I can't wait for the next episode!
Great to hear!
Griffpatch : What would you like to see next? Offscreen enemies? A level designer? Or should we go deeper?
Me : YOU CAN GO DEEPER?! This is awesome!
You are just the master of scratch and I can't think of anyone better in scratch than you
I think that griffpatch's voice is so calming and soothing, his side job could be a therapist.
yep for 3 years later shoud have did this insted of the platfomer or the rpg or the flappy bird
Incredible tutorial! With this epic tile based collision it will be so cool to add moving enemies that also move and sense blocks off-screen. Awesome! :D
Got to admit, my jaw dropped a bit on the key sensing in the operator. Clever.
Hey Griffpatch!
First of all, I would like to say thank you for taking out your time to help us so we can make better scratch projects. I subscribed to your channel few months ago, and you have been so helpful ever since. Really, thank you so much :)
And another awesome tutorial! Your editing skills have become so better. Everyone, please don’t become impatient with griffpatch, he is trying to help us. However, he needs to think farsightedly, to prevent any problem or bug in future tutorials. So don’t complain if he takes time. Take as much time as you want, Griffpatch, and do keep us updated.
Also, just a question, is it possible if we ask any doubt we have in our scratch projects to you? No problem if you aren’t free or anything, just a question.
Thank you once again!
Yes it sure is ok, just make sure to include your project ID in the comment if you need help because it's hard for me to keep track of conversations so better if I see them right off.
@@griffpatch Thank you :D
@@griffpatch ?
@@griffpatch Thank you so much!
@@griffpatch I was just using one of your awesome tutorials once again and for some reason when mario goest the top of the screen only then the y scrolling happens can you help me? scratch.mit.edu/projects/488900058/
I used the first 2 episodes to create a nice parallax tile based scrolling background on top of the foreground tiles 2. Each tile is 96x96 so as to not exceed the clone limit :)
I look on your channel every 5 minutes to see if you've posted the next part that is how much I love this! shame I've got online learning
Not to worry - Online learning super important - Scratch will be there when your done! woo hoo!
hmmmmm...for some reason the broadcast receiver "move player" doesn't seem to be receiving the message.
Same
@@Rory432 did you even set up a block that sends out the message and that they have the same message?
Thank you for your hard work! It's amazing how it's even possible to do this in Scratch. I think the next tutorial should be about animations (while also fixing the horizontal collisions and infinite jumping, of course).
I agree completely - those are all on my high priority to-do list
@NewSuperMarioBah What brings you here?
It depends on how long this series will be, but I think an important step will be how to make individual levels. Once a level editor is implemented, I'm interested to see how you would store level information in a list(s?) for multiple levels. Anyways, nice video as always, it's really nice that nothing is rushed while new ideas are still constantly being introduced.
I know that if I rush something it just ends up with people getting stuck... and that's such a shame.
Hey griffpatch, I don't think you have noticed but the link for part 4 brings us right back on episode 3!
Thanks! fixed
I've never seen a scrolling platformer better than this!
Its just so good
The extent to which you optimize everything boggles my mind, the "right arrow - left arrow" had me going "whaaaaa"
Cool right :)
There is a reason why this guy made my childhood with paper minecraft
I’ve never been able to get collision in my games so it makes it hard to make things with walls or other things people can interact with so I’m so glad this video is out it will help me with my main problem with making games!
24:22 plz do
- jumping instead of flapping
- give mario a width (and plz explain why to put the collision points into the corners instead of the middle of the edges, or vice versa, or how to do line collision)
- level editor (but in a seperate project)
- everything else you mentioned
- multiple levels (ok, you'd just need to add another list :p)
- a level exit point (like a specific tile, location or a flag pole)
- enemies that can destroy blocks (solid tiles with a solid value less than e.g. 5)
I like your videos, keep doing that greatness
Also your voice so relaxing wow
"How many variables do u want in this tutorial Griffpatch?"
"Yes"
Thanks a lot griffpatch for the awesome tutorial! This is really useful! Will the next part of this series be about how to make your own levels?
Possibly! - But perhaps first we should round off the platformer scripts? - It's a tricky balance because there's so much to add to each component of the game :) - And we want to cover everything!! hehe
@@griffpatch Ok, great! Can't wait for the next video!
@@bitcode1009 As usual!
@@metegurses708 Are you worthy for that
@@bitcode1009 same, i just think griffpatch should upload it daily it would be easier for me
I watched the video, than had a problem, than watched it again and fixed it! you explain things so well, thank you!
Yay, New episode, now I can sleep LoL
ua-cam.com/video/KLVaEJzIjS8/v-deo.html
I recommend this game in Scratch
@@verasadventures5494 I am sorry, but i played it and it is trash
@@verasadventures5494 try to do game with smaller delay
@@SUPY_ ok
When I was making Minecraft clone, I used scripts from old Scratcharia version, and broke all my game xD Now, with your tutorial, I fix it! Thanks!!!!!!
Dude put some grammar in ur comment and no offense\
@@phantomgaming8477 , I know english bad, sorry :(
I’m early which means I can learn about this faster!
ua-cam.com/video/KLVaEJzIjS8/v-deo.html
I recommend this game in Scratch
@@verasadventures5494 Stop
I did a sort of hollow knight style game to a very basic degree with this, I’m normally working on Unity for games but I realised that it wasn’t my lack of knowing languages, I was bad at the actual logic behind it, watching your tutorials with your clear explanations helped
Awesome!
9:41 Can't you just do X then Y? It would be easier to understand. Just do this: (X*10) + (Y + 1). You can get the tile index that way. Or will it all just break?
Sorry I'm late to the party btw :P
thanks griffpatch for taking your time and making videos about this tile scrolling platformer game (really cool).
I went on youtube but I couldn't do anything before seeing this.
OMG I got hearted by griffpatch!!!!
Wait...
everyone did...
I like how griffpatch is at 27.3k subs but still hearts comments when he sees good ones.
Man,seriously
What
Whta I love the most is that on the actual project on the website, it's completely blank so you have to learn how it works without just capitalizing off of someone elses work.
This was great! I do personally think it would be better to add more platforming scripts such as jump though platforms, slopes, and drop through platforms before any level design features. Also, will we add a player width just as we did a player height for better collision, or will we leave it only detecting the center of the player's x?
Yes, the next tutorial is dedicated to making the platforming work (including width). We won't get into the special platform types yet though - too much for me to cover right off.
21:42 griffpatch is a genius
Thank you so much griffpatch for another amazing tutorial! You inspire me so much and I'm thankful for your dedication to helping other scratchers enhance their skills on the scratch website. Thanks for the tutorial,
_THE-ONE-AND-ONLY_
NOBODY CARES
@@thatdragond6452 Thank you! :D
you are the best scratch tutor and the best programmer i've seen in my life. that's right i'm 12 but i still learn scratch from you. that's why i am a good scratch programmer. thanks a lot
Yay, I'm really pleased I've been able to help you on your coding journey :D
It’s here!
Nothing is more satisfying than completing a griffpatch tutorial without any errors in the code
Wow - good work, really pleased!
Amazing tutorial! I've learnt a lot from this. Why do you also check the collisin for the middle of the player? Is this because if you were not to, a block between the two collision points could be allowed? With larger players (half size being more than 32) this issue could reappear, right?
Spot on - I did have a little bit in my original dialog about that, but I cut it out as the video was getting a little too long. Since mario is 50ish pixels high, a 32 pixel high block could easily slip between head and feet sensors so the middle on e has to remain.
ua-cam.com/video/KLVaEJzIjS8/v-deo.html
I recommend this game in Scratch
@@verasadventures5494 Stop
My mind was blown again!!! I would be interested in seeing how you would tackle slopes and off screen enemies.
Really enjoy the tutorials. You are one of the best coders I've seen.
Wow, thanks!
this is why griffpatch is my favourite scratch
Not being hasty, but when's the next part coming?
Im very excited xD
the fact that he liked every comment but this makes me wanna give you a hug
It wasn't intentional that I didn't heart it - it's that youtube flagged it as "held for review" until I unflagged it, but then it was lost lower down in the comments! It's a but annoying that it does that!
@@griffpatch No Problem griffpatch, we understand :)
i remade this in unity, and it turned out great! thanks!
w
Oh yeah, also for some reason, when the right hand wall (or the ceiling) comes fully on screen, the camera jerks upwards to a really weird place that I didn’t even know was there. Any advice on how to deal with this? Thanks 😊
Have you found a fix
Ok normally I don't play videos on 1080p HD (bc my internet is bad), but I'm using a mini-screen so I can have the video playing while I'm on scratch making the project, and it's usually really blurry, but the video looks so amazing in 1080p :O
Yay another one! Wow, this was a lot of progress, I learned so much, very well explained! I can't wait for the next one, these videos are the best! Fantastic job!
Yay, thank you!
I know a lot about Scratch, but I didn't know that variables could support Booleans! Thanks for the video!
5:32 Haha nice little joke that makes the video better :)
The trick you do with the "when key pressed" block and the minus operation is so cool. Btw awesome videos :)
First, YES!
Also, amazing video as always, keep up the great content!
You are indeed the first comment
lol
WOAH! Captions make the video 10x better! Great editing! I can see the effort behind this ;)
when you find the tutorial the day this one was made
20:22
griffpatch: maths is fun
me: bruh, you've got to be kidding me...
lol
@@griffpatch lol
i just finished this part and its already sooooo good. i love ur work griffpatch!! :D
I've been deciding if I should try this out, and I've decided to start tomorrow. I can't wait to start making this!
You can do it! :) - Let me know how you get on!!!
@@griffpatch Thanks! This looks pretty detailed and looks like it'll be fun to make.
It is incredible how your tutorials can cover so much in only 20-30 min! Keep up the great work! You are awesome!
this completely fried my brain with the number of blocks and variables needed
Hey, griffpatch uses Scratch Addons, no surprise!
I noticed a Control F one, what other addons/plugins does he use?
@@mattsnows7971 The ctrl+F addon is part of Scratch Addons, make sure you've enabled it in the extension's settings
0:04 Mario learned how to use Luigi's powers :O
That's so cool. Literally the coolest thing I've ever seen being made by a Scratcher. Love your videos so MUCH!👍
Griffpatch Rocks!!
"It's testing time!" My favorite words :3
griffpatch when making custom blocks: I AM SPEED
Oh! Just that little true/false to 1/0 trick is so helpful! I know you can do similer things in programming languages like Javascript, but I didn't know you could do that in scratch!
Yes that's why I wanted to include it!
@@griffpatch Well thank you!
Thank you griffpatch for making this awesome tutorial. I was waiting for this
Yes. This video was useful when making collisions in my Terraria v1.0 project. Thanks!
I was tinkering around with this and found out that if you put change y by Y - Camera Y / 20. If you do that instead of divided by 4 then it’s really good for games.
Griffpatch the funny thing in your tutorials is that you create lots of variables and custom blocks in all of your tutorials lol xD.
Griffpatch’s editing skills have gotten really good lol
I loved the part where griffpatch said "It's testing time" and tested all over the place.
this is the best tutorial series ever known to me.
My school chromebook loved this!
They eat my tutorials for their breakfast :D
I'm amazed at how you keep your code so organized
griffpatch is back at it again!
You should be given an award from UA-cam titled "Fastest time to release 3 parts of a tutorial"
Yes I should lol
PART 4! PART 4! I'M READY FOR PART 4!
this couldn't be more helpful, couldn't it?
Hi griffpatch! I've been following you on Scratch for a long time and recently discovered your UA-cam channel. Your projects are amazing, just like your tutorials! 😀
Awesome! Thank you!
The scratch lord strikes again!
I don't regret subscribing. *SCRATCH ON!*
Scratch on!
i was observing your channel for a while and then this pops up! nice job mate!
Heyo
@@NightCat28 oh hey dude. following the tutorial too?
@@Meow-Gobo yep
Best scratcher in the world. Couldn't do this without you
thank you for the script arrangement extension
Thank yuo for making tutorials like this; they allow us to actually ask you questions that you might actually see!
Did I just say yuo? xD
You're very welcome!
Griffpatch does such a good job at making this easy to follow along
I so happy I can get to part 4! maybe... the reason I said maybe cause each time I try to do this tutorial I just fail and fail and fail each time but now I'm doing good
Hi griffpatch. I was just wondering on why you didn’t use a hit box. I feel it could have made it easier instead of coding all of those scripts for beach collisions.
b e a c h c o l l i s i o n s
lol
who knew it would be so easy to learn such a great game engine?
you are the king of Scratch
Although it's hard to make,but I've finished it!Congratulations!