Scratch RPG | Devlog #02 | Tile Layering & Collisions

griffpatch · Beginner ·🛠️ AI Tools & Apps ·3y ago

Key Takeaways

Develops a Scratch RPG with tile layering and collisions using a multi-layer tiling system and editing features

Full Transcript

[Music] hello fellow scratchers welcome back to episode 2 of my devlog building an RPG a role-playing game in scratch this project is destined to be one huge epic tutorial so to ensure I get things right before the official tutorials begin I'm documenting my journey so you can join in the fun last time I shared how I managed to get a working tile scrolling engine and began work on an awesome level editor but there were problems specifically gaps appearing between tiles gosh I mean look at this tree so stay tuned for a look at how this can be fixed and later on find out why Collision detection in this project almost brought me to tears yes it's true are you ready let's delve in well let's start with these ugly tile edges I knew when I picked this tile set that this would be an opportunity to try something new many of the tiles are not full squares but instead have transparent masked regions and only look good when they're layered on top of another full tile the existing tile grid system I have only supports a single layer of tiles but it's no big deal to duplicate that up and then have a way to set which layer I want to edit in the editor here I am editing layer 1 the bottom layer once the grass is placed down I can switch to layer 2 using the number 2 key on my keyboard and begin laying down the tree again oh yes this is much better do you see how the grass shows through the edges of the tree perfect let me do the same for the raised area below smooth out our layer 1 and then on layer 2 brush in the raised grass area again super I'm really liking that and it doesn't stop with these costumes we can also now bring in one of the larger structures like this awesome looking house as you can see the layering works great now I'll just stop there as I don't have a lot of room but what I wanted to show you was this although having two layers allows us to fix the issue with costumes overlapping we could take this further what if we were walking behind this house shouldn't this high up roof appear layered in front of the player the same goes for this tree right well watch this I'll remove the upper portion of the house from layer 2 and introduce the new layer 3. if we assume our player is standing on layer 2 then everything we paint on layer 3 is above them and so it is we can create this really fun illusion of depth we can walk in front of the house but also behind it so cool layer 3 is in front of the player this same applies to this tree that makes the level so much more immersive you might realize quite quickly that certain tile costumes will consistently need placing on the same layers so to speed up the placement I added a cool feature to assign a default layer to each tile type in the tile palette see that the ground tiles are all on layer 1 the Treetops layer 3 and the tree trunk on layer 2 and you'll love this I can change the default layer right within the editor just by tapping the number Keys cool stuff so let's see this in action I can switch to Auto layer mode and lay down a tree to confirm it worked we just check we can walk around it what a cool feature but I can't help but wish there was as a way to speed up tile placement especially for these larger assets that are constructed from many many smaller tiles it just gets so tedious in our Mario tutorial we introduced tile Auto arranging do you remember that where tiles would automatically switch as we drew to make them fit together correctly that was sweet but for a tile set of this complexity it might be tricky but because of the tiles are already laid out in the same order we want to lay them down I came up with another idea to make this work I think you're going to love this too what I can do is hold down space before I start drawing and then as I move across with my mouse the selected tile in the tiles palette also switches in the same direction I move this way in no time at all I can lay down an entire house wow look at that and it's done it with all the correct layers too so cool also if I move into some free space see how I can press space and just move my mouse around so even without drawing I can switch costume this way I can pick out the exact costume I'm after without having to click over in the palette to the right this also works for more intricate structures I can choose when to move on to the next tile costume as I draw as it follows an easy predict pattern well since we can change costumes so easily now we can even work full screen without having the need to have the palette visible now that is really useful and I can still pick to use any tile visible on the screen using the tile picker e key and then continue to work from there so the building process is super optimized now which is fantastic news for us imagine how much faster we will be able to put together and try out our RPG worlds yeah of course there are still a few layering combinations that are just not possible with three layers so we need to just work around them for the time I'm being clever level design has always been a big part of tile based adventure games man this is all looking so so cool I just can't wait to make this into a game are you as excited as me yeah okay guys the editor is really shining so I decided it was time to focus on the actual player and their movement in the game or more specifically where they can't walk due to a tile Collision now because we are stamping costumes we don't have the luxury of using scratch's Sprite touching blocks instead we have to go off the tile grid list contents we know which tiles our player is touching and we work from there the simplest approach would be to tag each tile costume with a straightforward I am solid I am not solid status then we can calculate if the tile We Touch is solid we stop the player and if not we can walk on but in the tile sheet that I chose things are not that clear-cut these tiles for example are certainly not fully solid but they do have solid edges it appears so my next idea was to Define which edges of each tile are solid I coded up an awesome Edge editor right into the level editor so I could quickly sketch on the solid edges per tile and then I got to work scripting up the Collision code and no it wasn't quite as straightforward as I hoped but I got there and here we go I can tell you things are working pretty sweet well for some time at least I kept this design but problems have emerged some of the tiles in the tile set don't fit with my Edge Collision Concept as the Collision edges in the costumes don't align to the edge of the Sprite at all this was very upsetting after all that hard work and I was a little stumped as what best to do so I thought if the tiles were designed with half tile collisions in mind maybe defining which quarters are solid and which are not would be a better system yes I had to recode it all and no it didn't work I sadly forgotten I'd need to factor in the cases where the Collision edges were paper thin rubbish never mind so what back to edges we could use edges but segment them into half edges oh man this is getting far too complicated and then I had a different idea how about rather than edges we switched to nine pins in each tile each pin could be solid or not and the rule is that the player's hitbox cannot pass through a pin as long as the hitbox is bigger than the distance between the pins then we could never pass through a gap yeah that was it this was a system I was happy enough with it worked and that was not deadly hard to script oh thank goodness and thank you for watching my devlog if you're excited to get started with the actual tutorial then smash that like button now and let me know what you are most excited about in the comments below the video don't forget to subscribe to the channel too I'm thinking we might begin next week with a tutorial on the text engine as that will be super useful both for this RPG and many other projects besides so yeah subscribe and make sure to check that Bell icon too in the meantime work on this RPG continues and with the help of Crystal keeper 7 do check out his YouTube channel we have begun to expand and update our tile set too but that's it for today I hope you have a great week ahead and scratch on guys [Music] thank you [Music] thank you

Original Description

Scratch Devlog Week 5 - building an Epic RPG, and I moved to a multi layer tiling system, and added more super useful editing features to speed up the level building process. Tile collisions with the player almost bring me to tears, and certainly drive me half crazy, see the 5 different systems I tried out! Full Solid tiles, Edge collisions, Half tiles, segmented edges, and the final 9 pin approach. 🚀 *Boost Your Creativity with Griffpatch* The Griffpatch Academy will take you from "Gamer to Game Creator" Learn more at 👉 https://griffpatch.academy 👈 😺 Scratch was developed by the Lifelong Kindergarten Group at the MIT Media Lab. See http://scratch.mit.edu 👀 Devlog #01 - https://youtu.be/KkiEvojtKYc 👀 Tutorial #01 - It's begins - https://youtu.be/5lof-Nu1VVE ✂️ Image / Sprite sheet Splitter - https://ezgif.com/sprite-cutter 💾 Amazing Tileset - https://o-lobster.itch.io/adventure-pack 🔗 Other Tilesets - https://opengameart.org/art-search?keys=rpg 🔗 Zelda Official - https://www.spriters-resource.com/snes/legendofzeldaalinktothepast/ 🐱 Scratch Starter Projects with Asserts - Remix this! https://scratch.mit.edu/projects/725577493/ --------------Video Chapters-------------- 0:00 Intro 0:43 Overlapping Tiles, and Tile Layering 2:02 Layer 3 – In front of the Player 2:51 Auto Layer Assignment 3:37 Auto Arranging Tiles or Prebuilt Assets 5:50 Tile Colliders – 1. Either solid, or not 6:46 2. Tile Edge Colliders 7:35 3. Half Tiles 7:55 4. 12 Edges per tile? 8:06 5. Collider Pins 8:37 Outro
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from griffpatch · griffpatch · 0 of 60

← Previous Next →
1 Burrow Blitz - A game by Griffpatch
Burrow Blitz - A game by Griffpatch
griffpatch
2 Burrow Blitz Level 1 Speed Run!
Burrow Blitz Level 1 Speed Run!
griffpatch
3 Scratch Messaging Extension (for chrome & firefox)
Scratch Messaging Extension (for chrome & firefox)
griffpatch
4 Scrolling Platformer Tutorial | Part 1 | Get Scrolling
Scrolling Platformer Tutorial | Part 1 | Get Scrolling
griffpatch
5 Scrolling Platformer Tutorial | Part 2 | Gravity
Scrolling Platformer Tutorial | Part 2 | Gravity
griffpatch
6 Scrolling Platformer Tutorial | Part 3 | Platform Detection
Scrolling Platformer Tutorial | Part 3 | Platform Detection
griffpatch
7 Scrolling Platformer Tutorial | Part 4 | Off Screen Sprites and Player Death
Scrolling Platformer Tutorial | Part 4 | Off Screen Sprites and Player Death
griffpatch
8 Scrolling Platformer Tutorial | Part 5 | Collectables
Scrolling Platformer Tutorial | Part 5 | Collectables
griffpatch
9 Scrolling Platformer Tutorial | Part 6 | Danger Sprites (Bug fix)
Scrolling Platformer Tutorial | Part 6 | Danger Sprites (Bug fix)
griffpatch
10 Scrolling Platformer Tutorial | Part 7 | Exit Portal
Scrolling Platformer Tutorial | Part 7 | Exit Portal
griffpatch
11 Scratch 3 | Box2d |  Physics Extension
Scratch 3 | Box2d | Physics Extension
griffpatch
12 Scrolling Platformer Tutorial | Part 8 | Vertical Scrolling
Scrolling Platformer Tutorial | Part 8 | Vertical Scrolling
griffpatch
13 Zombie Cube | Speedrun challenge
Zombie Cube | Speedrun challenge
griffpatch
14 Scratch 3 | Physics Extension | Version 2
Scratch 3 | Physics Extension | Version 2
griffpatch
15 Top Down Scroller | E1 - Scrolling | Scratch Tutorial
Top Down Scroller | E1 - Scrolling | Scratch Tutorial
griffpatch
16 Top Down Scroller | Part 2 | Enemy AI
Top Down Scroller | Part 2 | Enemy AI
griffpatch
17 Top Down Scroller | Part 3 | Enemy Clones & List
Top Down Scroller | Part 3 | Enemy Clones & List
griffpatch
18 Top Down Scroller | Part 4 | Live Die Repeat (Game Over)
Top Down Scroller | Part 4 | Live Die Repeat (Game Over)
griffpatch
19 Top Down Scroller | Part 5 | You've Won!
Top Down Scroller | Part 5 | You've Won!
griffpatch
20 Cloud Game Tutorial | Part 1 | The Basics
Cloud Game Tutorial | Part 1 | The Basics
griffpatch
21 Cloud Game Tutorial | Part 2 | Encoding and Decoding
Cloud Game Tutorial | Part 2 | Encoding and Decoding
griffpatch
22 Scratch 3 Dev Tools Browser Extension by griffpatch
Scratch 3 Dev Tools Browser Extension by griffpatch
griffpatch
23 Cloud Game Tutorial | Part 3 | Multiplayer
Cloud Game Tutorial | Part 3 | Multiplayer
griffpatch
24 Scrolling Platformer Tutorial | Part 9 | Momentum
Scrolling Platformer Tutorial | Part 9 | Momentum
griffpatch
25 Scrolling Platformer Tutorial | Part 10 | Wall Jumping
Scrolling Platformer Tutorial | Part 10 | Wall Jumping
griffpatch
26 Cloud Game Tutorial | Part 4 | Auto Game Joining
Cloud Game Tutorial | Part 4 | Auto Game Joining
griffpatch
27 Game Preview - "Getting Over It" with Griffpatch - A fan recreation in Scratch
Game Preview - "Getting Over It" with Griffpatch - A fan recreation in Scratch
griffpatch
28 Speed Run with Outtakes | Getting Over It | 4 minutes 30 seconds
Speed Run with Outtakes | Getting Over It | 4 minutes 30 seconds
griffpatch
29 Griffpatch's Live Stream
Griffpatch's Live Stream
griffpatch
30 MMO Platformer Speedrun Challenge
MMO Platformer Speedrun Challenge
griffpatch
31 Appel Platformer | Scratch Game Blog
Appel Platformer | Scratch Game Blog
griffpatch
32 Cloud Game Tutorial | Part 5 | Smooth Movement
Cloud Game Tutorial | Part 5 | Smooth Movement
griffpatch
33 How to Design a Level for Appel
How to Design a Level for Appel
griffpatch
34 Fastest Appel Speedruns | Jan 2021
Fastest Appel Speedruns | Jan 2021
griffpatch
35 Tile Scrolling Platformer (Mario) | 1. Setup
Tile Scrolling Platformer (Mario) | 1. Setup
griffpatch
36 Tile Scrolling Platformer | 2. Grid List
Tile Scrolling Platformer | 2. Grid List
griffpatch
37 Tile Scrolling Platformer | 3. Tile Collisions
Tile Scrolling Platformer | 3. Tile Collisions
griffpatch
38 Tile Scrolling Platformer | 4. Platforming Scripts
Tile Scrolling Platformer | 4. Platforming Scripts
griffpatch
39 Tile Scrolling Platformer | 5. The Level Editor
Tile Scrolling Platformer | 5. The Level Editor
griffpatch
40 Tile Scrolling Platformer | 6. Level Codes
Tile Scrolling Platformer | 6. Level Codes
griffpatch
41 Tile Scrolling Platformer | 7. Drop Through Platforms
Tile Scrolling Platformer | 7. Drop Through Platforms
griffpatch
42 How to make Physics in Scratch | Full Tutorial
How to make Physics in Scratch | Full Tutorial
griffpatch
43 Tile Scrolling Platformer | 8. Enemy Clones
Tile Scrolling Platformer | 8. Enemy Clones
griffpatch
44 Simple Pathfinding Tutorial
Simple Pathfinding Tutorial
griffpatch
45 Tile Scrolling Platformer | 9. Enemies in Level Editor
Tile Scrolling Platformer | 9. Enemies in Level Editor
griffpatch
46 Simple Maze Generation | Scratch Tutorial
Simple Maze Generation | Scratch Tutorial
griffpatch
47 Tile Scrolling Platformer | 10. Mystery Blocks
Tile Scrolling Platformer | 10. Mystery Blocks
griffpatch
48 Simple Car Steering Simulation | Scratch Tutorial
Simple Car Steering Simulation | Scratch Tutorial
griffpatch
49 Simple Background Scrolling Tutorial
Simple Background Scrolling Tutorial
griffpatch
50 Tile Scrolling Platformer | 11. Death, Background & Sound
Tile Scrolling Platformer | 11. Death, Background & Sound
griffpatch
51 Mid Week Update & Channel Membership
Mid Week Update & Channel Membership
griffpatch
52 Simple Grid List Tutorial with Image Scanning
Simple Grid List Tutorial with Image Scanning
griffpatch
53 Tile Scrolling Platformer | 12. Auto Arranging Tiles
Tile Scrolling Platformer | 12. Auto Arranging Tiles
griffpatch
54 Code a Fun Space Shooter Game 🚀 | 1. Move & Shoot | Scratch Tutorial
Code a Fun Space Shooter Game 🚀 | 1. Move & Shoot | Scratch Tutorial
griffpatch
55 Space Shooter 2 - Enemy Collisions
Space Shooter 2 - Enemy Collisions
griffpatch
56 Tile Scrolling Platformer | 13. Level Progression & Editor Improvements
Tile Scrolling Platformer | 13. Level Progression & Editor Improvements
griffpatch
57 Space Shooter 3 - Camera Shake & FX
Space Shooter 3 - Camera Shake & FX
griffpatch
58 Tile Scrolling Platformer | 14. Sloping Tiles
Tile Scrolling Platformer | 14. Sloping Tiles
griffpatch
59 Pathfinding a Maze using Lists
Pathfinding a Maze using Lists
griffpatch
60 Tile Scrolling Platformer | 15. Crouch & Slide
Tile Scrolling Platformer | 15. Crouch & Slide
griffpatch

Related Reads

📰
The Shift From Prompting to Building: How Beginners Are Creating Real Apps Without Writing Code
Beginners can now create real apps without writing code, thanks to new AI-powered tools, and this shift is changing the way we approach software development
Medium · AI
📰
10 Free AI Tools That Feel Like Magic in 2026
Discover 10 free AI tools that can streamline tasks and improve productivity, and learn how to apply them in your daily work
Medium · AI
📰
3 Practical AI Tools for Developers Who Want Control Over Their AI Spend
Discover 3 practical AI tools that give developers control over their AI spend, helping to reduce costs and increase transparency
Dev.to · Muhammed Amar
📰
Reviving Nigerian Cultural Heritage with AI-Generated Videos
Learn how AI-generated videos can revive Nigerian cultural heritage by increasing global awareness and engagement with traditional festivals
Dev.to AI

Chapters (11)

Intro
0:43 Overlapping Tiles, and Tile Layering
2:02 Layer 3 – In front of the Player
2:51 Auto Layer Assignment
3:37 Auto Arranging Tiles or Prebuilt Assets
5:50 Tile Colliders – 1. Either solid, or not
6:46 2. Tile Edge Colliders
7:35 3. Half Tiles
7:55 4. 12 Edges per tile?
8:06 5. Collider Pins
8:37 Outro
Up next
3 Unbelievable AI Tools to Automate Your Literature Review (Ethically)
Academic English Now
Watch →