Part 3 of the Farming Simulator tutorial for CS4040 Game Design students. Shows how to correctly handle y-sorting to successfully allow your 2D character to be on top of TileMap elements while standing in front, and in back while standing behind. Builds off of Jackie Codes Godot 4 TileMap Tutorial series linked below. Note that while the player movement is compatible with the latest version of Godot, Godot 4.3 overhauls the TileMap system and is not forward compatible with Jackie Codes tutorial series. I use version 4.2.2 in this video.
Jackie Codes Tutorial Series: • Godot 4 TileMap Tutorial Ep 1 | Setup...
The steps laid out in this video are also described below:
Enable y-sort for World Node2D under Ordering settings in Inspector.
Enable y-sort for TileMap under Ordering settings in Inspector.
Enable y-sort for Environment TileMap layer and change z-index to 1 under Ordering settings in Inspector.
Enable y-sort for Player CharacterBody2D instance and change z-index to 1 under Ordering settings in Inspector.
If it doesn’t work right, you may need to change the y-sort origin of your tree tile. The y-sort origin is the point on the TileMap where other bodies will transition from being in front to being behind. This is also determined by the player’s CollisionShape2D. Go to TileSet→Paint. Select y-sort origin from the property drop-down. Attempt to change the origin to something around 4 and paint the new property on the tree tiles. Your value might be slightly different based on your collision shapes.
Enable y-sort for cliffs TileMap layer and change z-index to 1 under Ordering settings in Inspector.
If needed, adjust y-sort origin for all cliff tiles by painting a new value in the TileSet view.
Debug → "Visible collision shapes" to see collision shapes during game play and troubleshoot boundaries. Adjust collision layers of player and TileMap as needed.
Смотрите видео Y-Sorting for Farming Simulator in Godot 4.2 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Michael D'Argenio 24 Октябрь 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 17 раз и оно понравилось людям.