Y-Sorting for Farming Simulator in Godot 4.2

Published: 24 October 2024
on channel: Michael D'Argenio
178
0

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.


Watch video Y-Sorting for Farming Simulator in Godot 4.2 online without registration, duration hours minute second in high quality. This video was added by user Michael D'Argenio 24 October 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 17 once and liked it people.