One-way collision layers and objects

This commit is contained in:
Dustin 2025-06-12 18:25:13 -07:00
parent 42035d7907
commit a500bc96d4
5 changed files with 134 additions and 2 deletions

View File

@ -2,7 +2,7 @@
[ext_resource path="res://src/classes/camera_guide.gd" type="Script" id=1] [ext_resource path="res://src/classes/camera_guide.gd" type="Script" id=1]
[ext_resource path="res://src/Camera2D.gd" type="Script" id=2] [ext_resource path="res://src/Camera2D.gd" type="Script" id=2]
[ext_resource path="res://src/levels/TestBox.tscn" type="PackedScene" id=3] [ext_resource path="res://src/levels/TC_05.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/ui/scene_transition.tscn" type="PackedScene" id=4] [ext_resource path="res://src/ui/scene_transition.tscn" type="PackedScene" id=4]
[ext_resource path="res://src/ui/HUD.tscn" type="PackedScene" id=5] [ext_resource path="res://src/ui/HUD.tscn" type="PackedScene" id=5]
[ext_resource path="res://settings.tres" type="Resource" id=6] [ext_resource path="res://settings.tres" type="Resource" id=6]

View File

@ -1,4 +1,4 @@
[gd_resource type="TileSet" load_steps=21 format=2] [gd_resource type="TileSet" load_steps=24 format=2]
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/Tiles/Tiles.png" type="Texture" id=1] [ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/Tiles/Tiles.png" type="Texture" id=1]
@ -59,6 +59,15 @@ points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=15] [sub_resource type="ConvexPolygonShape2D" id=15]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=20]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=21]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=22]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[resource] [resource]
0/name = "RockPlatform" 0/name = "RockPlatform"
0/texture = ExtResource( 1 ) 0/texture = ExtResource( 1 )
@ -284,3 +293,43 @@ points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ] } ]
4/z_index = 0 4/z_index = 0
5/name = "Bridge"
5/texture = ExtResource( 1 )
5/tex_offset = Vector2( 0, 0 )
5/modulate = Color( 1, 1, 1, 1 )
5/region = Rect2( 80, 112, 80, 48 )
5/tile_mode = 2
5/autotile/icon_coordinate = Vector2( 0, 0 )
5/autotile/tile_size = Vector2( 16, 16 )
5/autotile/spacing = 0
5/autotile/occluder_map = [ ]
5/autotile/navpoly_map = [ ]
5/autotile/priority_map = [ ]
5/autotile/z_index_map = [ ]
5/occluder_offset = Vector2( 0, 0 )
5/navigation_offset = Vector2( 0, 0 )
5/shape_offset = Vector2( 0, 0 )
5/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
5/shape = SubResource( 20 )
5/shape_one_way = true
5/shape_one_way_margin = 1.0
5/shapes = [ {
"autotile_coord": Vector2( 1, 2 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 20 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 2 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 21 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 2 ),
"one_way": true,
"one_way_margin": 1.0,
"shape": SubResource( 22 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
5/z_index = 0

View File

@ -422,6 +422,7 @@ dash_2={
2d_physics/layer_6="EnemyHurtbox" 2d_physics/layer_6="EnemyHurtbox"
2d_physics/layer_7="PlayerHitbox" 2d_physics/layer_7="PlayerHitbox"
2d_physics/layer_8="EnemyHitbox" 2d_physics/layer_8="EnemyHitbox"
2d_physics/layer_9="World-OneWay"
2d_physics/layer_11="Climbable" 2d_physics/layer_11="Climbable"
common/enable_pause_aware_picking=true common/enable_pause_aware_picking=true
2d/default_gravity=600 2d/default_gravity=600

View File

@ -94,6 +94,7 @@ extents = Vector2( 9, 15 )
extents = Vector2( 4, 3 ) extents = Vector2( 4, 3 )
[node name="PlayerE" instance=ExtResource( 1 )] [node name="PlayerE" instance=ExtResource( 1 )]
collision_mask = 257
script = ExtResource( 3 ) script = ExtResource( 3 )
actor_type = "Player" actor_type = "Player"
player_number = 1 player_number = 1

81
src/levels/TC_05.tscn Normal file
View File

@ -0,0 +1,81 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
[ext_resource path="res://assets/Fonts/default_font.tres" type="Theme" id=7]
[sub_resource type="RectangleShape2D" id=2]
[node name="TC_05" groups=["world"] instance=ExtResource( 1 )]
[node name="TileMap Background" parent="." index="0"]
z_index = -2
[node name="TileMap Collision" parent="." index="1"]
tile_set = ExtResource( 2 )
tile_data = PoolIntArray( -262145, 4, 0, -327661, 4, 0, -196609, 4, 0, -262125, 4, 0, -131073, 4, 0, -196589, 4, 0, -65537, 4, 0, -131053, 4, 65536, -1, 4, 0, -65517, 4, 65536, 65535, 4, 0, 19, 4, 65536, 131069, 4, 0, 131070, 4, 0, 131071, 4, 0, 65555, 4, 0, 65556, 4, 65536, 65557, 4, 65536, 65558, 4, 65536, 196605, 4, 0, 131094, 4, 65536, 262141, 4, 0, 196630, 4, 65536, 327677, 4, 0, 262145, 2, 1, 262146, 2, 2, 262161, 2, 0, 262162, 2, 1, 262166, 4, 65536, 393213, 4, 0, 393214, 4, 0, 393215, 4, 0, 327680, 4, 65536, 327681, 2, 65537, 327682, 2, 65538, 327697, 2, 65536, 327698, 2, 65537, 327699, 4, 65536, 327700, 4, 65536, 327701, 4, 65536, 327702, 4, 65536, 393216, 4, 0, 393235, 4, 0, 458752, 4, 65536, 458771, 4, 65536, 589823, 0, 1, 524288, 4, 131072, 524289, 0, 3, 524290, 0, 1, 524291, 0, 2, 524292, 0, 3, 524293, 0, 1, 524294, 0, 2, 524295, 0, 3, 524296, 0, 1, 524297, 0, 2, 524298, 0, 3, 524299, 0, 1, 524300, 0, 2, 524301, 0, 3, 524302, 0, 1, 524303, 0, 2, 524304, 0, 3, 524305, 0, 1, 524306, 0, 2, 524307, 4, 0, 524308, 0, 1, 524309, 0, 2, 524310, 0, 3, 655359, 0, 65537, 589824, 0, 65538, 589825, 0, 65539, 589826, 0, 65537, 589827, 0, 65538, 589828, 0, 65539, 589829, 0, 65537, 589830, 0, 65538, 589831, 0, 65539, 589832, 0, 65537, 589833, 0, 65538, 589834, 0, 65539, 589835, 0, 65537, 589836, 0, 65538, 589837, 0, 65539, 589838, 0, 65537, 589839, 0, 65538, 589840, 0, 65539, 589841, 0, 65537, 589842, 0, 65538, 589843, 0, 65539, 589844, 0, 65537, 589845, 0, 65538, 589846, 0, 65539, 720895, 0, 131073, 655360, 0, 131074, 655361, 0, 131075, 655362, 0, 131073, 655363, 0, 131074, 655364, 0, 131075, 655365, 0, 131073, 655366, 0, 131074, 655367, 0, 131075, 655368, 0, 131073, 655369, 0, 131074, 655370, 0, 131075, 655371, 0, 131073, 655372, 0, 131074, 655373, 0, 131075, 655374, 0, 131073, 655375, 0, 131074, 655376, 0, 131075, 655377, 0, 131073, 655378, 0, 131074, 655379, 0, 131075, 655380, 0, 131073, 655381, 0, 131074, 655382, 0, 131075, 786431, 0, 196609, 720896, 0, 196610, 720897, 0, 196611, 720898, 0, 196609, 720899, 0, 196610, 720900, 0, 196611, 720901, 0, 196609, 720902, 0, 196610, 720903, 0, 196611, 720904, 0, 196609, 720905, 0, 196610, 720906, 0, 196611, 720907, 0, 196609, 720908, 0, 196610, 720909, 0, 196611, 720910, 0, 196609, 720911, 0, 196610, 720912, 0, 196611, 720913, 0, 196609, 720914, 0, 196610, 720915, 0, 196611, 720916, 0, 196609, 720917, 0, 196610, 720918, 0, 196611, 851967, 0, 262145, 786432, 0, 262146, 786433, 0, 262147, 786434, 0, 262145, 786435, 0, 262146, 786436, 0, 262147, 786437, 0, 262145, 786438, 0, 262146, 786439, 0, 262147, 786440, 0, 262145, 786441, 0, 262146, 786442, 0, 262147, 786443, 0, 262145, 786444, 0, 262146, 786445, 0, 262147, 786446, 0, 262145, 786447, 0, 262146, 786448, 0, 262147, 786449, 0, 262145, 786450, 0, 262146, 786451, 0, 262147, 786452, 0, 262145, 786453, 0, 262146, 786454, 0, 262147 )
[node name="TileMap Ladders" type="TileMap" parent="." index="2"]
tile_set = ExtResource( 2 )
cell_size = Vector2( 16, 16 )
show_collision = true
collision_layer = 256
collision_mask = 256
format = 1
tile_data = PoolIntArray( 65540, 5, 0, 65544, 5, 4, 65548, 5, 0, 65552, 5, 4, 131076, 5, 65536, 131077, 5, 65537, 131078, 5, 65538, 131079, 5, 65539, 131080, 5, 65540, 131084, 5, 65536, 131085, 5, 65537, 131086, 5, 65538, 131087, 5, 65539, 131088, 5, 65540, 196612, 5, 131072, 196613, 5, 131073, 196614, 5, 131074, 196615, 5, 131075, 196616, 5, 131076, 196620, 5, 131072, 196621, 5, 131073, 196622, 5, 131074, 196623, 5, 131075, 196624, 5, 131076, 262152, 5, 0, 262156, 5, 4, 327688, 5, 65536, 327689, 5, 65537, 327690, 5, 65538, 327691, 5, 65539, 327692, 5, 65540, 393224, 5, 131072, 393225, 5, 131073, 393226, 5, 131074, 393227, 5, 131075, 393228, 5, 131076 )
[node name="TileMap Foreground" parent="." index="3"]
tile_set = ExtResource( 2 )
collision_layer = 0
collision_mask = 0
tile_data = PoolIntArray( 524288, 0, 2, 524307, 0, 3 )
[node name="PlayerStart" parent="." index="4"]
position = Vector2( 50, 131 )
[node name="EnterLeft" type="Position2D" parent="." index="5"]
position = Vector2( -12, 61 )
[node name="EnterRight" type="Position2D" parent="." index="6"]
position = Vector2( 332, 61 )
[node name="LevelTransition" parent="." index="7" instance=ExtResource( 4 )]
position = Vector2( -11, 64 )
_transition_type = "door_left"
_destination_level = "res://src/levels/CloneBox.tscn"
_destination_position_name = "EnterRight"
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"]
modulate = Color( 1, 0, 1, 1 )
shape = SubResource( 2 )
__meta__ = {
"_edit_lock_": true
}
[node name="LevelTransition2" parent="." index="8" instance=ExtResource( 4 )]
position = Vector2( 333, 64 )
_destination_level = "res://src/levels/TC_02.tscn"
_destination_position_name = "EnterLeft"
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition2" index="0"]
modulate = Color( 1, 0, 1, 1 )
shape = SubResource( 2 )
__meta__ = {
"_edit_lock_": true
}
[node name="Camera Bounds" parent="." index="9"]
tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 16, 0, 0, 524287, 0, 0, 458768, 0, 0, 589824, 0, 0, 589839, 0, 0 )
[node name="Label" type="Label" parent="." index="10"]
margin_left = 78.0
margin_top = 9.0
margin_right = 244.0
margin_bottom = 41.0
theme = ExtResource( 7 )
text = "Test chamber 05:
Ladders and One-Way
Floors"
align = 1
valign = 1