-
Notifications
You must be signed in to change notification settings - Fork 36
Description
It would be nice to be able to adjust the Z Index on specific tiles from the tiled editor. This would help with tiles that should cover other objects. As an example, the game I am working on has a doorway, the player sprite should walk under the doorway, but right now it walks on top of the doorway.
I am able to achieve this result manually by modifying the tileset that gets exported and setting the specific tile to have a Z Index of 1. However if I reexport the project this gets overridden and I have to redo all the Z Indexes in the tileset. The ideal solution would be to allow a custom property on a tile called "zIndex" which should be an integer, this should get exported to the godot tileset format.
Here is an example godot tileset that uses the z index:
[gd_resource type="TileSet" load_steps=5 format=2]
[ext_resource path="res://maps/dungeon.png" type="Texture" id=1]
[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 9, 0, 54, 0, 54, 54, 9, 54 )
[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 6, 0, 54.5, 0, 54.5, 53.5, 6, 53.5 )
[sub_resource type="ConvexPolygonShape2D" id=3]
points = PoolVector2Array( 6, 0, 54.5, 0, 54.5, 53.5, 6, 53.5 )
[resource]
0/name = "dungeon 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 1024, 1024 )
0/tile_mode = 2
0/autotile/icon_coordinate = Vector2( 0, 0 )
0/autotile/tile_size = Vector2( 64, 64 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ Vector3( 3, 9, 1 ) ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape = SubResource( 1 )
0/shape_one_way = false
0/shape_one_way_margin = 1.0
0/shapes = [ {
"autotile_coord": Vector2( 14, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 13, 12 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 2 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 9, 15 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 3 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0
The important line to generate is:
0/autotile/z_index_map = [ Vector3( 3, 9, 1 ) ]
This indicates that the tile located at x = 3 and y = 9 is set to a Z Index of 1. This means the player passes under that tile because the player I have is set to Z Index 0.