Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Wow! looks great! Metal Gear solid feel :)

I'm just starting using Godot, could you please tell me how you implemented hiding behind boxes? 

Do you change player's Z position when the player crosses some Y position?

Oh dear, sorry I've only just seen this. If you or anyone else needs to know:
I have a YSort node, with two children: The TileMap with all the objects like the boxes, and the Player. I don't think I did anything special to the tilemap or the tiles themselves... make sure that in your TileMap node, you set the Tile Origin correctly to either center or bottom. I haven't looked at this project or Godot in a while!

Thank you for reply! :) 

Could you please explain what YSort node does here? What is the logic?


(2 edits)

All children of a YSort node will be displayed in a particular order, based on their y positions. Child nodes with a higher y position will appear on top of nodes with a lower y position. So rather than using Godot's default "Z index", or level hierarchy to determine what goes on top of something else, it's using the y position of each object - things lower on the screen will be in front!

So when the player's origin point is below the box's origin point, that means the player should appear in front of the boxes. Once you move the player up so that their origin point is above the boxes' origin point, the boxes will be drawn on top instead.

Note that for this type of game, each object's origin point should be set to "bottom", at the point where they "touch the ground". Having it set in the middle of the object can lead to weird results.

Oh Wow! Thank you so much for such a precious piece of information! :)