for 2024 people that want to apply these, TileMap is marked as deprecated, SO use TileMapLayer (each tile map layer you add is equals to a layer basically, activate ySorting FOR the one you want to be applied to, same settings as in the video, just apply to each individual TileMapLayer element), if u use multi layer, when editing the colision shape, press the eye next to your TileMapLayers to hide / show elements you used with that layer so you actually apply to the layer's elements you added, speaking from experience here, i added collision shapes to layerOne instead of LayerTwo and i was confused why no collision shapes appeared. AND if you wanna se you shapes while debuging, click on the Debug (top left next to Settings / Project etc) and check the Vissible Collision shape option to see them permanently)
I could not seem to get the Y Sort Origin to set but finally realized you have to set the number, then click the tile to apply that number to the tile. Just in case anyone else was confused.
Thank you! I had the same problem. At 6:21 it seems DevWorm turns Y-sorting on on the player, but that didn't work for me. Turning it on on the collision shape instead made it work like it should. :D
thank you. while this is a good tutorial, still needs some polish. instructor needs to be more verbal in EXACTLY what they are doing. i.e. what keystroke or buttons they are pressing.
I couldnt get my player's head to stop dissappearing behing the "chest". Once I turn off y-sorting on the player it, it now appears normal. What is your player's Ordering/y-sort value ? enabled(checked) or disabled(unchecked) ?
7:15 Little tip. Godot will do simple math for you. So if you have the y position at 13 and you wanna move it by 15 positively, just do 13 + 15 and it will solve and give you the number. This works for anywhere that you can put in numbers, even resolution. It's very useful so you don't need to try to do mental math or bust out a calculator. If I recall right this works with - + * /
Its actually amazing how much software have this built in. Like I do all my pixel art in gimp and every single entry box with a numeric value abides by this so I can multiply the canvas size!
if you have an issue where the y sorting is not work. try this : 1. assume that you have turn on the "y sort renabled" at tilemap in ordering sectionn 2. you have to turn on "y sort enabled" in layer section too, and give the layer z-index 1
for anyone who is having issues here the steps for Y sorting : Make sure player Y Sort Enabled is Disabled and Z Index = 1, Z as Relative = ON, The TileMap Z index = 0, Z as Relative = ON, Y Sort Enabled = ON, all layers Y Sort = ON, grass layer Z Index = 0, cliff layer aka second layer Z index = 1, Last layer Trees ets Z Index = 1 make sure all 3 Layers have Y Sorting = ON
a little extra tips maybe for those who have tried and still haven't succeeded you could go to the Tileset at the Visibility menu and make sure the the top level is on
As a first time godot learner and programer I find these videos are great for learning the features of godot. This one was a bit choppy but I understand you are playing with a brand new feature so it makes sense. The best part of this for me so far was the programing the character node. Other programing learning tools i've use basically give you a list of things to write without explaining how functions or variables work which I found odd as when I asked my brother he explained it clearly in under 60 seconds. I found the practical use of the programing code shown in game as well as clear explanations of why you were writing each line of code really helped where vetran programers with their beginner tutorials has not helped me. So thanks for making these videos. Super excited to start my first project!
Anyone who's player is disappearing after passing y = 0, the warning that was ignored here seems relevant, as ysort layer seems like it should be above the regular tilemap layers, so on the ysort layer z-index you want to set that to 1 and also set your player root nodes index to 1 as well
Got stuck, but something that helped me: turn Y-sorting on for the collision shape of your player, not the player themselves. Also, don't forget to turn it on for the whole world, lol.
@@feryanwibowo241The top node in your scene Altho this is misleading, because the actual root node is the game window, which is a node only visible while the game is running on the Remote tree view
This worked for me! I miss having a node to sort this kind of thing. Checking a box in every single node involved in y-sorting is extremely tedious and easy to forget...
I'm a complete beginner and I'm enjoying the series so far, but sometimes it's really hard to follow what you are doing with the erratic mouse movements and clicking through panels super fast, especially when you get mixed up or forget something. It would be much easier to follow if you slowed down a little bit and maybe edited/scripted a bit more and/or explained in a voiceover what errors you made and how you're fixing them. Thanks.
Just wanna chime in and say that I'm not a complete beginner and still feel this. Content is great, but a little extra scripting and editing wouldn't hurt. The back half was challenging to follow.
HOT TAKE - The man is giving away gold for free. Be gracious. He is building a game, AND educating us. THANKS DUDE!!! We need to put the work in if we want to follow his tips. He's not going to spoon food you, no one should. This isn't a university class. Good luck everyone, happy gaming.
For me I had to set the world>TileMap>Layers[ysort layer]>Z index to 1 to make the ysorting work. It made the second error warning disappear. Great video!
for anyone struggling to see the character, your tile map needs to be highest on the node list. Also the other little error he got about the z index, the tile map itself is set to 0 so in your ysort layer just put z index to 1 or 2 or however many layers you got, just not 0
this is very interesting, when I tried this ysorting with Godot 4.0, I had so much hassle and it was just not working. I downloaded the most recent version of Godot 4 (I believe I downloaded Godot 4.2), and now, I was able to get Ysorting to work with legitimately NO issues, hassle, no stress. Everything that worked for you worked for me. Everything you encountered that did not work did not work for me either. In other words, this newest version of Godot 4 is working perfectly with your tutorial videos! Thank you so much!
I came across this randomly. Didnt know what y sorting was but this was what I was looking for. I really appreciated the way this video went down and really appreciated the quality in your tutorial. I subscribed and look forward to more stuff. :)
this is amazing man!!!! thank you so much!! please keep making more videos about godot4. I think youre the most up to date and helpful godot teacher there is currently
Can someone please explain to me, at around 7:00 when we go to the player and we do a negative off-set of -15 to the Y, which is it doing here specifically? I played around, and if you don't do this step, your characters body will go behind the plants when in front. Is this some kind of layering technique? And when I make my own game, will it always be -15 that I set this by?
Thank you very much, I thought that this value was not "specific" and I put another one and it didn't work for me, you solved my error thanks to your comment, I hope someone answers why it is set -15
0:40 intro 1:00 Add Tile Collision Shapes 4:22 Add Player CollisionShape2D 5:38 Fix Player CollisionShape2D 7:40 Add Y-Sort Origin to Tiles 10:22 Enable Y-Sort to Tilemap 10:50 It Works Enable y-sort to: - world scene - worl node - tilemap - ysort layer inside tilemap - player scene - collision shape 2d inside player scene (i think i'm not forgetting any)
not gonna lie, this was really difficult for me to get and figure out. NOT YOUR FAULT it was all me, but after rewinding a bunch, I finally got it. Thanks for helping me to get it. On to the next part in the tutorial!
I started having issues with Y sorting at some point, thought I'll never get it fixed. enabled Y sort all over the place, started panicking... and then I tried setting Y Sort Origin on the objects layer (named ysort in the video - where all objects are placed). I set it to 10 and was still behind the objects, then set it to -10 and VOILA - everything worked as expected (in front of stone when walking in front, behind it when walking behind)! hope it helps someone!
In 1:29 you click on the tree. How do you make an 'object' composed of different tiles like that tree? I find myself adding collision shapes to each individual tiles of the tree trunk, instead of just having one collision shape. Any help is appreciated.
It's in his previous video of the playlist. To quote Whisping1: You need to go world scene -> TileMap, then select TileSet at the bottom, next press Setup. You need to select whole tree as one tile using Shift + drag your mouse with pressed left button. If before tree was selected like separate tiles, you will need to erase these tiles w/ eraser tool. Do not forget to turn eraser off after erasing.
If I don’t use a tilemap and have a lot of objects in a scene, I try to organize them into blank white nodes, like putting all the enemies in an “enemies” node and trees in a “trees” node. But Y sorting doesn’t work when I do this. I thought it would because the blank nodes don’t have any transforms. So, my only option might be to just let them stay messy as siblings of my player node.
Tip: If you want to select a tilemap tile without applying the current collision shape, use CTRL+click. If the tile does not have a shape drawn, you will need to select the Add polygon tool to draw a new shape (tiny box above the image of the tile you just selected).
Something that confused me that I finally fixed. When I created the tileset, I pressed "yes to automatically create tiles in the atlas", which made everything one block so I could not select the entire tree, which in turn I was unable to correctly put the ysort on it. You need to press no and then hold shift click to make larger tiles as he shows.
Make sure when you are initially making your tiles that you do the shift+drag method for the entire tile that you want to make. I inidivually clicked each tile in an "entitiy" and it did not correctly apply the gravity. I got hung up on the shrub because of that, I was not getting the entire shrub to do the collision for at a time.
Ysorting makes it look like already some professional top down RPG game 😍😍 I'm excited for the next videos in this series, thank you so much, @DevWorm 😃
NOTE: godot made so many updates and stuff, and this guy missed some stuff, so basically, aftter you create your layers and stuff, there are 2 important things to know, first is the Z index and Y sort, it kinda takes long to explain but, basically go to your world and layers, and make sure that the Z index of the layers are lower than the "player" z index, at default all should be 0, just go and make the player z index 2, and for the Ysort layer make its Z index 1, and thats all to fix it
Just an extra note I spend a couple days trying to solve, 1: The layers that we are moving around have to have the same Z index. Be super careful to account for relative Z indexing, both the player and object need to have the same absolute Z index. 2. EVERY parent of anything using y sorting NEEDS to have Y sorting on. I got stuck for a few days because I never turned y sorting on in the root scene itself. I mean granted this seems dumb as why would it need Y sorting if its not the actual object moving around, just some of its children are.
Mine finally works now, i had to combine a few comment suggestions; I set all of the y-sorting on each individual thing (trees, rocks etc) to -16 i set the Z for the y-sorting TileMap Layer to 1 i set the Z for the player to 1 it now works! :D Hope this helps someone!
When I have z index = 1 in my y_sort layer and z index = 0 in every other layer / node, suddenly the physics layer doesn't work. When all of my z index numbers are set to 0 (and "y sort enabled" is selected in my world, tilemaps and player nodes), it suddenly works. Not sure why, but thought I'd put that out there in case someone else ran into the same issue.
for me my head goes behind the tree when i am beneath whilst the rest of the body is in front of the tree so is this normal and do you go over ir later or did i do something wrong thanks
I don't exactly remember what I cover here but recently I created a much more updated y-sorting video, but it sounds like your y-sort origin is offset weirdly.
I'm working on being so much more consistent with my upload schedule!!! trying for every other day from here on out. I want to do everything I can to try and help the Godot community.
i messed with the Y-Sort enabled setting. To hide behind the elements you have configured, you just need to enable “cliff" on TileMap, Ordering, and World.
it may be because the enemies layers and mask arnt the same as the environment or maybe there isnt a collisionshape within the enemy? Hoping to help.. but i am totally unsure unless I could look at the project!
@dev-worm appreciate it! I have copied everything from your tutorial playlist so it's all the exact same. Not sure if yours works, and I missed a small detail.
Hello, dear DeWorm. Do the lessons on creating a simple level system. An example of such a system. the player takes experience points, and after that his characteristics of speed, attack, etc. change. Or how to make sure that after filling the experience bar progress strip so that the player's weapon changes?
@@dev-worm thx, maybe I'll come back to that offer later on. Currently I finished godots 2D tutorial, now I'll rebuild it on my own. After that I'll come back to your tutorial. From there on I'm probably good to go. A lot feels very familiar, coming from unity.
is there a way to do this with out tile maps? I've basically imitated this using a foreground/background layer, but if there was a way to program it a little more fluidly in a game that does not use tile maps - that would be ideal.
hi, i have some problem and i dont know how to solve it. When i'm selecting the tiles to ysort they do not fit into one but are divided. Can someone help please?
i have an interesting little bug. I added a camera and stuff to my player so i could make a bigger map and explore. Well I drew my map all around the world origin, and after setting the ysort stuff, everything above the world origin got hidden (including the player until i turned off the ysort on the world node.) Even with that fix however, anything from my ysort tileset that i draw above that point disappears immediately. Anyone have a solution for me? I was considering just moving the worlds origin point up to the top, so that I can't go above it, hiding the elements of the scene, but i can't figure out how to do that if you even can. Inversely I don't think that I can move all the tiles down beneath it either can I? It doesn't matter for the purposes of this tutorial, but for my reference going forward i'd love to hear any suggestions! Thanks in advance!
@@coocool92 after further tinkering I realized it has to do with the y sort layer origin not the world. However if you move that origin it fucks up the ysort, so I guess just going forward if I want to use this method instead of making instanced scenes i have to draw the map beneath that point
@@coocool92 I'm so glad I could help :) hopefully my information isn't flawed tho I'm still new to this stuff! So use my info as a jumping off point to seek what you need. I will say chatgpt can help figure things out but they need to update it's info for Godot 4 before it can be super useful for this iteration. But it may help at least. Good luck on your dev journey friend!
I came accross this problem that no tutorial seems to explain, nor do I get any help from the documentation: how to make y sorting work with CharacterBody2Ds. So if I have an enemy or an NPC, I cannot get my player character to go behind them. I've offset the sprites, turned on Y sorting in everything, nothing works. I wonder if it's a problem with the sprites themselves (like having too much empty space below the character or something) or if there's some way to set a Y sort origin for CharacterBody2Ds, but I cannot get it to work.
@@tbelev12what is it? I'm stuck here too Edit: clicking on TileMap does it. And to think that I once tried to follow the tutorial but somehow thought changing the rendering engine to Forward+ would fix this (instead I got locked out of my project file because I somehow can't update my video drivers on this old laptop I'm using). Trying to follow the tutorial again after nearly two months of studying. The answer was right there lol.
Thanks for this, great tutorial, but I have an issue where my objects (trees, rocks, stumps etc.) are going behind the grass/ground layer instead of in front of it like in the video and it only seems to happen in the top half of the map, the bottom half is fine. Anyone know how to fix this?
Hello, I will use the translator, I apologize if something is not understood, my problem is that I followed the entire tutorial to the letter but when I run the game my person "gets" under the tree trunks, I don't understand, It should be seen completely from the front but it gets underneath, when passing behind it it hides perfectly but the problem is when passing in front
is y-sort turned on, on all the nodes? even the parent nodes? and the main scene node? and also are you getting any errors? I really want to help you out so let me know so we can try and solve this!
@@dev-worm Hello, thanks for responding to my comment, I was able to solve it thanks to the comment of the user @Testikillz, he commented the following below, perhaps he has not seen it "Can someone explain to me, around 7:00, when we go to the player and do a negative offset of -15 to the Y, what is it doing here specifically? I played and if you don't do this step, the Your character's body will go behind the plants when it is in front. Is this some kind of layering technique? And when I make my own game, will it always be -15 like I set it to?” Thanks to this comment I realized that the value -15 was the one I had to set and I couldn't change it, when I put another one I got the error, could you explain to us why -15 was set? thank you
Started watching your series to learn how to program a game, and so far its been very helpful. However, in this video you have the same warning on your tile map that says "a y-sorted layer has the same Z-index value as a not Y-sorted layer" and I can't figure out how to remove that. The problem that I'm having now is everything above the X axis line is Y-sorted and my char is walking behind it all. I do have all my trees and rocks and whatnot on their own layer, and everything below the X-Axis and left/right of Y-axis line are working as intended. I'm confused, if ya see this, could you attempt to assist with the issue, thanks!
Actually figured it out, each layer has a Z-Index, and you have set them in correlation to your character. Basically make your char a higher # so it walks on top of everything, but higher than your character if ya need to go under it, then Y-Sorting for going behind. Its confusing especially if you're building with an X-axis for each layer of tiles but if ya play around and test with it, you'll get it. @@whitedovedown5266
It's not exactly the clearest thing how the Y Sort works. However, here are the settings I used to get it working myself. Y Sort Enabled: world > Ordering: true TileMap > Layers > ysort: true TileMap > Ordering > true player > Ordering > false player > AnimatedSprite2D > Ordering and CollisionShape2D > Ordering: does not matter
why do all tiles share the same physical points config ? My tree and bush have same physical points... and when I change points for bush they also change points for tree...
FOR ANYONE STILL NOT GETTING CORRECT Y SORTING. They need to be on the same Z layer. From what i have seen. I haven't tested this with tile maps. I am testing this on pickups.
Curious on how you have the tree as 1 giant area you can click and not 9 individual areas like I have it. When I click one of the 9 areas, only that area is shown in the paint properties area, when I continue to click the other areas, only those appear there. How do I make the area 1 large one like you have so I can see the whole tree in the paint properties area? If that makes sense.
yes so in the tileset editor you can right click on the tiles and delete the existing tiles so you are able to create your own and when you create your own you can click on a area then hold down shift and drag to create a box which will end up being a tile that takes up multiple tile areas. So for you just delete the 9 tiles that make up the tree then hold shift and click and drag mouse to create the bigger tile out of those 9. hope this helps a bit! thanks for reaching out!
@@dev-worm Ok, i remember that in the previous video but I ignored it because it was already selected haha. Better just follow along with what you are talking about I guess..haha
okay works but now the player goes behind the tilemap if I go above the tilemap y sort, I can just move the tilemap upwards so far that this wont ever happen but is there a better way?
or you could put the cliffs you want infront of the player on a different level in the tilemap and increase the z-index so it shows in front of the player
yes.. but the player won't go infront or behind the tree... because it'll only either go infront or only behind.. y-sort just changes the z-index based on the y coordinate!
@@dev-worm Oh yeah, I didn't notice yesterday because of the collision so I thought the character was in front of the stone with the z-index.. Now that I see that you said the same thing in the video I feel dumb.. Thank you for making this video.
aye man, 6 months later but go back to your tileset, delete the squares with the eraser and select the objects while holding shift+ctrl and mouse drag.
I'm currently trying to figure out what's wrong. I have Y sort on the tilemap and the layers I need it on for. Did the origin point, collision boxes, y sort on the player, but the player is still appearing on top of the trees.
really good video series to learn godot as a beginner! the only feedback i'd like to give is that you seem to move quite fast and it's hard to keep up with what's happening, especially when you go back and forth bc something didn't work on the first try. great stuff nontheless
thanks! sorry its a bit fast I do apologize! I wish back when I was filming these I would've noticed that so I could've slowed them down in turn making them easier to understand
currently having an issue of ysorting. I hear alot of people in comment saying they fix it because you can turn on vsorting on player and world. But Ysorting is toward children nodes?Don't really understand what that means
Love the series!!! How were you able to select the whole tree when changing its physics layer for me it only allows me to work on 1 tile at a time? xD Also the character seems to start with a 0 y-index so might be behind the tilemap for most people!
You need to go world scene -> TileMap, then select TileSet at the bottom, next press Setup. You need to select whole tree as one tile using Shift + drag your mouse with pressed left button. If before tree was selected like separate tiles, you will need to erase these tiles w/ eraser tool. Do not forget to turn eraser off after erasing.
@@Whisping1 I tried doing this but even when using shift + LMB drag it'll select everything as separate tiles. Unsure what I'm doing wrong here, but I can't get the tiles to be recognized as a single tile instead of separate.
Sorry for blowing up your notifications with fifteen comments and then erasing them. Basically I was having trouble at multiple points in the process, panicking, commenting, then subsequently figuring it out 😅
i fixed it, i had to set the tilemaps ordering z index to be the same as the player. I also had to put my y origin at the top of my 16x16 tile by setting it to -8
it might be because of the new Godot 4 update. As a lot of things have changed. I actually created a pretty recent tutorial on y-sorting for Godot 4.3 so that may help!
for 2024 people that want to apply these, TileMap is marked as deprecated, SO use TileMapLayer (each tile map layer you add is equals to a layer basically, activate ySorting FOR the one you want to be applied to, same settings as in the video, just apply to each individual TileMapLayer element), if u use multi layer, when editing the colision shape, press the eye next to your TileMapLayers to hide / show elements you used with that layer so you actually apply to the layer's elements you added, speaking from experience here, i added collision shapes to layerOne instead of LayerTwo and i was confused why no collision shapes appeared. AND if you wanna se you shapes while debuging, click on the Debug (top left next to Settings / Project etc) and check the Vissible Collision shape option to see them permanently)
very helpful!! pinning this now!! thank you so much for pointing that out!
@@dev-worm no, thank you for this awesome tutorial mate!
I could not seem to get the Y Sort Origin to set but finally realized you have to set the number, then click the tile to apply that number to the tile. Just in case anyone else was confused.
OMG I just spent 5 minutes trying to figure out why it wasn't working... Thank you!
Thank you! I had the same problem. At 6:21 it seems DevWorm turns Y-sorting on on the player, but that didn't work for me. Turning it on on the collision shape instead made it work like it should. :D
thank you. while this is a good tutorial, still needs some polish. instructor needs to be more verbal in EXACTLY what they are doing. i.e. what keystroke or buttons they are pressing.
I couldnt get my player's head to stop dissappearing behing the "chest". Once I turn off y-sorting on the player it, it now appears normal. What is your player's Ordering/y-sort value ? enabled(checked) or disabled(unchecked) ?
7:15 Little tip. Godot will do simple math for you. So if you have the y position at 13 and you wanna move it by 15 positively, just do 13 + 15 and it will solve and give you the number. This works for anywhere that you can put in numbers, even resolution. It's very useful so you don't need to try to do mental math or bust out a calculator. If I recall right this works with - + * /
Its actually amazing how much software have this built in. Like I do all my pixel art in gimp and every single entry box with a numeric value abides by this so I can multiply the canvas size!
if you have an issue where the y sorting is not work. try this :
1. assume that you have turn on the "y sort renabled" at tilemap in ordering sectionn
2. you have to turn on "y sort enabled" in layer section too, and give the layer z-index 1
My champion.
Thank you! Clicking forever finding the box I missed.
thank you
Its about 3 a.mI have been trying to solve this problem for like 4 o'clock, thank you :D
To build off of this: your player and ysort layer need to have the same z-index. Just figured it out.
for anyone who is having issues here the steps for Y sorting : Make sure player Y Sort Enabled is Disabled and Z Index = 1, Z as Relative = ON, The TileMap Z index = 0, Z as Relative = ON, Y Sort Enabled = ON, all layers Y Sort = ON, grass layer Z Index = 0, cliff layer aka second layer Z index = 1, Last layer Trees ets Z Index = 1 make sure all 3 Layers have Y Sorting = ON
Dude you're a life saver...my collision wasn't working for some reason, and this fixed the issue! Thanks a lot mate👍👍
Thank youuu my enemy was clipping under while the player was not, turning the tilemap z index to 0 solved it :)
a little extra tips maybe for those who have tried and still haven't succeeded
you could go to the Tileset at the Visibility menu and make sure the the top level is on
YOU ARE MY JESUS i was stuck for an hour thank you so much i owe you my newborn
@@NUUHYUUH newborn you say hmm
This is an amazing tutorial. You're like one of the only people doing tuts for latest version of Godot. Keep going and you'll corner the tut market.
As a first time godot learner and programer I find these videos are great for learning the features of godot. This one was a bit choppy but I understand you are playing with a brand new feature so it makes sense. The best part of this for me so far was the programing the character node. Other programing learning tools i've use basically give you a list of things to write without explaining how functions or variables work which I found odd as when I asked my brother he explained it clearly in under 60 seconds. I found the practical use of the programing code shown in game as well as clear explanations of why you were writing each line of code really helped where vetran programers with their beginner tutorials has not helped me. So thanks for making these videos. Super excited to start my first project!
Anyone who's player is disappearing after passing y = 0, the warning that was ignored here seems relevant, as ysort layer seems like it should be above the regular tilemap layers, so on the ysort layer z-index you want to set that to 1 and also set your player root nodes index to 1 as well
I had the same problem ! Thank you.
Wow, just that I was looking for!
Life-saver! Thank you, I saw so confused.
bless your soul. I was scrolling through all the solutions people had and none fixed it till this one
Thanks!
Got stuck, but something that helped me: turn Y-sorting on for the collision shape of your player, not the player themselves. Also, don't forget to turn it on for the whole world, lol.
THANK YOU!
Thanks.
Thank you!
Good thinking, thanks :D
What if I don't have a collision shape, I wonder.
For anyone who may still be having problems with y-sort not working. Make sure the root node has Y-sort enabled as well.
I am sorry what is root node
@@feryanwibowo241The top node in your scene
Altho this is misleading, because the actual root node is the game window, which is a node only visible while the game is running on the Remote tree view
This commentary helped someone.
Thank you.
This worked for me! I miss having a node to sort this kind of thing. Checking a box in every single node involved in y-sorting is extremely tedious and easy to forget...
Thank you :)
You have made learning and using Godot accessible to me after weeks of struggling to find an up to date course. Thank you!
so glad to hear that bro, if you ever need any help Im here for you.
i need help : 10:30 im still in front of the tree what can i do to fix that ??
I'm a complete beginner and I'm enjoying the series so far, but sometimes it's really hard to follow what you are doing with the erratic mouse movements and clicking through panels super fast, especially when you get mixed up or forget something. It would be much easier to follow if you slowed down a little bit and maybe edited/scripted a bit more and/or explained in a voiceover what errors you made and how you're fixing them.
Thanks.
Just wanna chime in and say that I'm not a complete beginner and still feel this. Content is great, but a little extra scripting and editing wouldn't hurt. The back half was challenging to follow.
HOT TAKE - The man is giving away gold for free. Be gracious. He is building a game, AND educating us. THANKS DUDE!!! We need to put the work in if we want to follow his tips. He's not going to spoon food you, no one should. This isn't a university class. Good luck everyone, happy gaming.
@@Amazing_Software No one is disagreeing with that,we're just saying things can be improved a bit. Also no uni class spoon feeds you everr
@@Amazing_SoftwareBro, constructive criticism is good for him too, better tutos can attract more ppl and more subs.
@@ACharlar22 Ok good point. But is there anyone else making better tutorials than this guy? We should give credit where it's due.
For me I had to set the world>TileMap>Layers[ysort layer]>Z index to 1 to make the ysorting work. It made the second error warning disappear.
Great video!
glad you were able to figure that out and everything was able to work!! thank you!
for anyone struggling to see the character, your tile map needs to be highest on the node list. Also the other little error he got about the z index, the tile map itself is set to 0 so in your ysort layer just put z index to 1 or 2 or however many layers you got, just not 0
thanks for pointing that out!
this is very interesting, when I tried this ysorting with Godot 4.0, I had so much hassle and it was just not working. I downloaded the most recent version of Godot 4 (I believe I downloaded Godot 4.2), and now, I was able to get Ysorting to work with legitimately NO issues, hassle, no stress. Everything that worked for you worked for me. Everything you encountered that did not work did not work for me either. In other words, this newest version of Godot 4 is working perfectly with your tutorial videos! Thank you so much!
I came across this randomly. Didnt know what y sorting was but this was what I was looking for. I really appreciated the way this video went down and really appreciated the quality in your tutorial. I subscribed and look forward to more stuff. :)
i really appreciate your series. i do wish you would edit out some oopsies as it gets confusing at times
haha thanks bro, ill work on that
this is amazing man!!!! thank you so much!! please keep making more videos about godot4. I think youre the most up to date and helpful godot teacher there is currently
working on many tutorials as we speak :D
Can someone please explain to me, at around 7:00 when we go to the player and we do a negative off-set of -15 to the Y, which is it doing here specifically? I played around, and if you don't do this step, your characters body will go behind the plants when in front. Is this some kind of layering technique? And when I make my own game, will it always be -15 that I set this by?
Thank you very much, I thought that this value was not "specific" and I put another one and it didn't work for me, you solved my error thanks to your comment, I hope someone answers why it is set -15
0:40 intro
1:00 Add Tile Collision Shapes
4:22 Add Player CollisionShape2D
5:38 Fix Player CollisionShape2D
7:40 Add Y-Sort Origin to Tiles
10:22 Enable Y-Sort to Tilemap
10:50 It Works
Enable y-sort to:
- world scene
- worl node
- tilemap
- ysort layer inside tilemap
- player scene
- collision shape 2d inside player scene
(i think i'm not forgetting any)
not gonna lie, this was really difficult for me to get and figure out. NOT YOUR FAULT it was all me, but after rewinding a bunch, I finally got it. Thanks for helping me to get it. On to the next part in the tutorial!
Thanks was looking for this feature and didn't know it was so extremely easily implemented in godot, awesome!
amazing to hear!! i hope it was able to help! thank you!
OMG YES!! I'VE BEEN WAITING FOR THIS..
I started having issues with Y sorting at some point, thought I'll never get it fixed. enabled Y sort all over the place, started panicking... and then I tried setting Y Sort Origin on the objects layer (named ysort in the video - where all objects are placed). I set it to 10 and was still behind the objects, then set it to -10 and VOILA - everything worked as expected (in front of stone when walking in front, behind it when walking behind)! hope it helps someone!
I'm gonna have to buy like 10 copies of your game dude. THANK YOU!!!!!
Glad I could help lol!
In 1:29 you click on the tree. How do you make an 'object' composed of different tiles like that tree? I find myself adding collision shapes to each individual tiles of the tree trunk, instead of just having one collision shape. Any help is appreciated.
It's in his previous video of the playlist.
To quote Whisping1:
You need to go world scene -> TileMap, then select TileSet at the bottom, next press Setup. You need to select whole tree as one tile using Shift + drag your mouse with pressed left button. If before tree was selected like separate tiles, you will need to erase these tiles w/ eraser tool. Do not forget to turn eraser off after erasing.
@@anthoniG it's quite unintuitive to find it out, I hope they make it more clear on future version. Thanks a lot for the tip!!
Thank you so much. Without your videos, achieving my personal dream would be a lot harder. I will do my best.
I'm following you series to try to get the basics to make my game. thank you.
If I don’t use a tilemap and have a lot of objects in a scene, I try to organize them into blank white nodes, like putting all the enemies in an “enemies” node and trees in a “trees” node. But Y sorting doesn’t work when I do this. I thought it would because the blank nodes don’t have any transforms. So, my only option might be to just let them stay messy as siblings of my player node.
Tip: If you want to select a tilemap tile without applying the current collision shape, use CTRL+click. If the tile does not have a shape drawn, you will need to select the Add polygon tool to draw a new shape (tiny box above the image of the tile you just selected).
what a crazy shit... even after reading your comment I spent 1 hour to find out why it reset shape ... ugliest UX
Something that confused me that I finally fixed. When I created the tileset, I pressed "yes to automatically create tiles in the atlas", which made everything one block so I could not select the entire tree, which in turn I was unable to correctly put the ysort on it.
You need to press no and then hold shift click to make larger tiles as he shows.
good point! glad you solved it and understand it a bit better now! I shouldve made that more clear in the video! thanks for pointing that out though!
@@dev-worm yes, you should!
you are INCREDIBLE, i was looking for it and dont even know the name of "ysort" for search, thanks m8 God bless u
thanks brother! so happy to hear that you were able to find what you needed!
plz continue and dont stop because i forgot every thing in godot it and when godot 4 release i cant understand anything . thanks alot
episode 4 is pretty long lol because its a combat system, but hoping to get it out tomorrow!
@@dev-worm i hope
Make sure when you are initially making your tiles that you do the shift+drag method for the entire tile that you want to make. I inidivually clicked each tile in an "entitiy" and it did not correctly apply the gravity. I got hung up on the shrub because of that, I was not getting the entire shrub to do the collision for at a time.
Ysorting makes it look like already some professional top down RPG game 😍😍 I'm excited for the next videos in this series, thank you so much, @DevWorm 😃
thank you so much!! I hope the rest of the series proves to be helpful!
NOTE: godot made so many updates and stuff, and this guy missed some stuff, so basically, aftter you create your layers and stuff, there are 2 important things to know, first is the Z index and Y sort, it kinda takes long to explain but, basically go to your world and layers, and make sure that the Z index of the layers are lower than the "player" z index, at default all should be 0, just go and make the player z index 2, and for the Ysort layer make its Z index 1, and thats all to fix it
Just an extra note I spend a couple days trying to solve,
1: The layers that we are moving around have to have the same Z index. Be super careful to account for relative Z indexing, both the player and object need to have the same absolute Z index.
2. EVERY parent of anything using y sorting NEEDS to have Y sorting on. I got stuck for a few days because I never turned y sorting on in the root scene itself. I mean granted this seems dumb as why would it need Y sorting if its not the actual object moving around, just some of its children are.
You're a lifesaver! Thanks for the video. This helped me a lot!
JUST MOVE THE COLLISION SHAPE WITH YOUR MOUSE IT'S NOT THAT HARD OMLLLLL
BRO TAKES FIVE HOURS TO GET TO THE DAMN YSORT
Mine finally works now, i had to combine a few comment suggestions;
I set all of the y-sorting on each individual thing (trees, rocks etc) to -16
i set the Z for the y-sorting TileMap Layer to 1
i set the Z for the player to 1
it now works! :D
Hope this helps someone!
thanks for pointing all this out!! I know it will prove to be helpful!!
When I have z index = 1 in my y_sort layer and z index = 0 in every other layer / node, suddenly the physics layer doesn't work. When all of my z index numbers are set to 0 (and "y sort enabled" is selected in my world, tilemaps and player nodes), it suddenly works. Not sure why, but thought I'd put that out there in case someone else ran into the same issue.
for me my head goes behind the tree when i am beneath whilst the rest of the body is in front of the tree so is this normal and do you go over ir later or did i do something wrong thanks
I don't exactly remember what I cover here but recently I created a much more updated y-sorting video, but it sounds like your y-sort origin is offset weirdly.
i was about to not use godot for the lack of digestible information on the new version of the game until i found your channel
I'm working on being so much more consistent with my upload schedule!!! trying for every other day from here on out. I want to do everything I can to try and help the Godot community.
i messed with the Y-Sort enabled setting. To hide behind the elements you have configured, you just need to enable “cliff" on TileMap, Ordering, and World.
Awesome walk throughs so far! One question I have is why does the enemy ignore physics layers? thank you!
it may be because the enemies layers and mask arnt the same as the environment or maybe there isnt a collisionshape within the enemy? Hoping to help.. but i am totally unsure unless I could look at the project!
@dev-worm appreciate it! I have copied everything from your tutorial playlist so it's all the exact same. Not sure if yours works, and I missed a small detail.
Hello, dear DeWorm. Do the lessons on creating a simple level system. An example of such a system. the player takes experience points, and after that his characteristics of speed, attack, etc. change. Or how to make sure that after filling the experience bar progress strip so that the player's weapon changes?
will for sure create that in the next series, which is going to be a survival game, so player stats will forsure be in that
@@dev-worm cool, and there you can explain how to make the simple construction system .
This feature convinced me to now try out Godot now. Seems so much easier that what I'm used to from Unity.
goodluck in Godot! if you need any sort of help in Godot then feel free to let me know!
@@dev-worm thx, maybe I'll come back to that offer later on.
Currently I finished godots 2D tutorial, now I'll rebuild it on my own.
After that I'll come back to your tutorial.
From there on I'm probably good to go. A lot feels very familiar, coming from unity.
For anyone have issue character disappear when moving up. Check the entire tile map to see if the map below the y = 0 coordiante.
very good point!
this is a very helpful tutorial! thanks!
is there a way to do this with out tile maps? I've basically imitated this using a foreground/background layer, but if there was a way to program it a little more fluidly in a game that does not use tile maps - that would be ideal.
Yes, all 2D nodes have Y sorting
hi, i have some problem and i dont know how to solve it. When i'm selecting the tiles to ysort they do not fit into one but are divided. Can someone help please?
i have an interesting little bug. I added a camera and stuff to my player so i could make a bigger map and explore. Well I drew my map all around the world origin, and after setting the ysort stuff, everything above the world origin got hidden (including the player until i turned off the ysort on the world node.) Even with that fix however, anything from my ysort tileset that i draw above that point disappears immediately. Anyone have a solution for me? I was considering just moving the worlds origin point up to the top, so that I can't go above it, hiding the elements of the scene, but i can't figure out how to do that if you even can. Inversely I don't think that I can move all the tiles down beneath it either can I? It doesn't matter for the purposes of this tutorial, but for my reference going forward i'd love to hear any suggestions! Thanks in advance!
had this same problem
@@coocool92 after further tinkering I realized it has to do with the y sort layer origin not the world. However if you move that origin it fucks up the ysort, so I guess just going forward if I want to use this method instead of making instanced scenes i have to draw the map beneath that point
@@hollowtongue oooh thank you, helped me understand what was wrong. At least now we know for the future
@@coocool92 I'm so glad I could help :) hopefully my information isn't flawed tho I'm still new to this stuff! So use my info as a jumping off point to seek what you need. I will say chatgpt can help figure things out but they need to update it's info for Godot 4 before it can be super useful for this iteration. But it may help at least. Good luck on your dev journey friend!
@@hollowtongue Good luck to you too!
Спасибо огромнейшее!!! Один из самых полезных туториалов!
When i made all of the collisions of the trees, bushes and other objects my player just won't move. Anybody know how to fix?
PS im running godot 4.3
I came accross this problem that no tutorial seems to explain, nor do I get any help from the documentation: how to make y sorting work with CharacterBody2Ds. So if I have an enemy or an NPC, I cannot get my player character to go behind them. I've offset the sprites, turned on Y sorting in everything, nothing works. I wonder if it's a problem with the sprites themselves (like having too much empty space below the character or something) or if there's some way to set a Y sort origin for CharacterBody2Ds, but I cannot get it to work.
it was a little hard too follow since I was not using a tilemap but it worked out, thank you.
glad it was all able to come together!
bro im stuck at 1:13 i did't have physics layers
sry i see what the problem was
@@tbelev12what is it? I'm stuck here too
Edit: clicking on TileMap does it. And to think that I once tried to follow the tutorial but somehow thought changing the rendering engine to Forward+ would fix this (instead I got locked out of my project file because I somehow can't update my video drivers on this old laptop I'm using). Trying to follow the tutorial again after nearly two months of studying. The answer was right there lol.
@@tbelev12 so what was the problem?
@@tbelev12 What's the problem? I'm stuck on this part too
@@gcpa7539Did you discover the problem?
Thanks for this, great tutorial, but I have an issue where my objects (trees, rocks, stumps etc.) are going behind the grass/ground layer instead of in front of it like in the video and it only seems to happen in the top half of the map, the bottom half is fine. Anyone know how to fix this?
im getting the same error where im phasing through tiles aswell.
Hello, I will use the translator, I apologize if something is not understood, my problem is that I followed the entire tutorial to the letter but when I run the game my person "gets" under the tree trunks, I don't understand, It should be seen completely from the front but it gets underneath, when passing behind it it hides perfectly but the problem is when passing in front
is y-sort turned on, on all the nodes? even the parent nodes? and the main scene node? and also are you getting any errors? I really want to help you out so let me know so we can try and solve this!
@@dev-worm Hello, thanks for responding to my comment, I was able to solve it thanks to the comment of the user @Testikillz, he commented the following below, perhaps he has not seen it
"Can someone explain to me, around 7:00, when we go to the player and do a negative offset of -15 to the Y, what is it doing here specifically? I played and if you don't do this step, the Your character's body will go behind the plants when it is in front. Is this some kind of layering technique? And when I make my own game, will it always be -15 like I set it to?”
Thanks to this comment I realized that the value -15 was the one I had to set and I couldn't change it, when I put another one I got the error, could you explain to us why -15 was set? thank you
Started watching your series to learn how to program a game, and so far its been very helpful. However, in this video you have the same warning on your tile map that says "a y-sorted layer has the same Z-index value as a not Y-sorted layer" and I can't figure out how to remove that. The problem that I'm having now is everything above the X axis line is Y-sorted and my char is walking behind it all. I do have all my trees and rocks and whatnot on their own layer, and everything below the X-Axis and left/right of Y-axis line are working as intended. I'm confused, if ya see this, could you attempt to assist with the issue, thanks!
Same issue im having.. Idk how to fix that
Actually figured it out, each layer has a Z-Index, and you have set them in correlation to your character. Basically make your char a higher # so it walks on top of everything, but higher than your character if ya need to go under it, then Y-Sorting for going behind.
Its confusing especially if you're building with an X-axis for each layer of tiles but if ya play around and test with it, you'll get it. @@whitedovedown5266
@@whitedovedown5266 you want to set the ysort layer z-index to 1 and also set your player root nodes index to 1 as well
you want to set the ysort layer z-index to 1 and also set your player root nodes index to 1 as well
i have a question. If players z index 0 and tilemaps layers 0 and 1. I need to make collision for player for both these layers. How to make it?
I'm having a problem with the Ysort of the character... it works when walking behind, but in front; his head is painted behind the object as well.
you found any solution?
It's not exactly the clearest thing how the Y Sort works.
However, here are the settings I used to get it working myself.
Y Sort Enabled:
world > Ordering: true
TileMap > Layers > ysort: true
TileMap > Ordering > true
player > Ordering > false
player > AnimatedSprite2D > Ordering and CollisionShape2D > Ordering: does not matter
You may not have set the offset of the player so that his sorting indicator is at his feet. Have a look at 6:40 onward
@@Alex002c Ah, thank you! I missed that it was 'y' offset and not just moving the sprite upwards.
@@kuivapastelli that was the solution for me....
why do all tiles share the same physical points config ? My tree and bush have same physical points... and when I change points for bush they also change points for tree...
FOR ANYONE STILL NOT GETTING CORRECT Y SORTING. They need to be on the same Z layer. From what i have seen. I haven't tested this with tile maps. I am testing this on pickups.
why does it show 2 players at diffrent position both operating simultaneously but one is with ysort and other is not? HELP
Curious on how you have the tree as 1 giant area you can click and not 9 individual areas like I have it. When I click one of the 9 areas, only that area is shown in the paint properties area, when I continue to click the other areas, only those appear there. How do I make the area 1 large one like you have so I can see the whole tree in the paint properties area? If that makes sense.
yes so in the tileset editor you can right click on the tiles and delete the existing tiles so you are able to create your own and when you create your own you can click on a area then hold down shift and drag to create a box which will end up being a tile that takes up multiple tile areas. So for you just delete the 9 tiles that make up the tree then hold shift and click and drag mouse to create the bigger tile out of those 9. hope this helps a bit! thanks for reaching out!
@@dev-worm Ok, i remember that in the previous video but I ignored it because it was already selected haha. Better just follow along with what you are talking about I guess..haha
how would you set the y sorting origin if im using a 2d body for my trees? (for chopping down animation is y I set it to a 2D body
How would YSorting work between two sprites? For exmaple a player and enemy or player and npc?
Perfect series, Perfect video
okay works but now the player goes behind the tilemap if I go above the tilemap y sort, I can just move the tilemap upwards so far that this wont ever happen but is there a better way?
im having an issue where when i try to walk in fornt of an object, my player clips through. any got any ideas
Very Chill explanation, love it
Wasn't sure if I missed something but for the cliffs, do you just have to go in and paint collision on all of them as well?
or you could put the cliffs you want infront of the player on a different level in the tilemap and increase the z-index so it shows in front of the player
@@dev-worm didn't even think of that option! Thanks man
When i enabled ysort for the map/node, some objects simply disappeared. Why is that?
but now you can still walk on top of the cliffs, right?
yes!! if you are on the other side of the collision then you should beable to!
Your MAIN node MUST be a NODE-2D not just a node. That way you can make the y-sort enabled for the whole world node under Ordering.
correct! im sorry i didnt point this out in the video!
Replying to thank you as I didn't realise that with the new tilemap system in 4.3 that I had my tilemaps as children of a normal node. Thanks!
can't you just accomplish the same by just using the z-index... or is there something I'm missing that might make y-sorting a better approach?
yes.. but the player won't go infront or behind the tree... because it'll only either go infront or only behind.. y-sort just changes the z-index based on the y coordinate!
@@dev-worm Oh yeah, I didn't notice yesterday because of the collision so I thought the character was in front of the stone with the z-index.. Now that I see that you said the same thing in the video I feel dumb.. Thank you for making this video.
1:44 and 8:09 I honestly didn't understand how you got 1 square y and I have all the squares separate, how can I fix it?
aye man, 6 months later but go back to your tileset, delete the squares with the eraser and select the objects while holding shift+ctrl and mouse drag.
I'm currently trying to figure out what's wrong. I have Y sort on the tilemap and the layers I need it on for. Did the origin point, collision boxes, y sort on the player, but the player is still appearing on top of the trees.
As it turns out, if I waited a couple more seconds, you mention turning it on for the world. When I did that, it worked.
haha glad to hear!
Great work on everything! But you missed the collisions of the cliff :(
there is godot 4.4 and tile map is not working so i work on tilemaplayers this doesnt work for ysorting for me
amazing tutorials bro keep it up
thanks brother!
really good video series to learn godot as a beginner!
the only feedback i'd like to give is that you seem to move quite fast and it's hard to keep up with what's happening, especially when you go back and forth bc something didn't work on the first try. great stuff nontheless
thanks! sorry its a bit fast I do apologize! I wish back when I was filming these I would've noticed that so I could've slowed them down in turn making them easier to understand
I couldn't get it to work until I figured out I needed to set the layer's z-index to 1 and the player's z-index to 1.
currently having an issue of ysorting. I hear alot of people in comment saying they fix it because you can turn on vsorting on player and world. But Ysorting is toward children nodes?Don't really understand what that means
y-sorting can only be enabled on those children if the parent node aka the world.. is also y-sort set to true
@dev-worm of that's the Case maybe player and world is both parent nodes. I will have to check that on my days off
The fiddling with collision shape and player offset is quite confusing..
just try and put the foot or bottom of the player at 0,0
@@dev-worm thank you, and for your tutorials as well!
Love the series!!!
How were you able to select the whole tree when changing its physics layer for me it only allows me to work on 1 tile at a time? xD
Also the character seems to start with a 0 y-index so might be behind the tilemap for most people!
You need to go world scene -> TileMap, then select TileSet at the bottom, next press Setup. You need to select whole tree as one tile using Shift + drag your mouse with pressed left button. If before tree was selected like separate tiles, you will need to erase these tiles w/ eraser tool. Do not forget to turn eraser off after erasing.
@Nikolai thank you for some reason my godot wasn't working but after restart what you mentioned worked 👍
Have you found a fix for this? I'm going crazy.
@@Whisping1 I tried doing this but even when using shift + LMB drag it'll select everything as separate tiles. Unsure what I'm doing wrong here, but I can't get the tiles to be recognized as a single tile instead of separate.
thanks i was stuck on this too :)
it did help... tysm!
glad it helped!
my character just appears behind the tree both above and below the collider. :S
Sorry for blowing up your notifications with fifteen comments and then erasing them. Basically I was having trouble at multiple points in the process, panicking, commenting, then subsequently figuring it out 😅
haha!! all good!! glad you were able to figure everything out!!
idk if this helps anyone, but for me y sorting worked after i only enabled it for the world and tilemap, not the player.
I set everything to Y-sort. I made the Y-sort origin. I made the separate layer for the tilemap. Is there something I am missing ? (edit was grammar)
i fixed it, i had to set the tilemaps ordering z index to be the same as the player. I also had to put my y origin at the top of my 16x16 tile by setting it to -8
Many thanks, this Tutorial helps me a lot
Glad to hear that!
I do not have physics layers as an option like he does, anyone know why?
it might be because of the new Godot 4 update. As a lot of things have changed. I actually created a pretty recent tutorial on y-sorting for Godot 4.3 so that may help!
when I enable y sorting the player is behind the ground or map layer. How do I fix this?
you may have y-sorting turned on on another of your layers (i guess your base layer). I had a similar thing going on.
Painting the Y Sort Origin doesnt seem to work, i cant select any tile and adjusting the value does nothing.
Nevermind, I figured it out
@@chrissinatorhd8569 How did you solve this?
how
@@chrissinatorhd8569
why cant my character go infront of objects every object is in front?
How i can do this for Enemy, he use animated sprite 2D
how do you do this if you arent using tile maps ? :(
use the pill shape and, under "transform", turn it by 90 degrees