Add collision layers

This commit is contained in:
Marco 2023-10-08 19:29:32 +02:00
parent c404f0197b
commit 8c0d239326
11 changed files with 148 additions and 4 deletions

View File

@ -58,3 +58,11 @@ down={
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(162, 13),"global_position":Vector2(166, 56),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null) , Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(162, 13),"global_position":Vector2(166, 56),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
] ]
} }
[layer_names]
2d_physics/layer_1="Player"
2d_physics/layer_2="Enemies"
2d_physics/layer_3="Objects"
2d_physics/layer_4="Projectiles"
2d_physics/layer_5="Items & Zones"

View File

@ -7,6 +7,8 @@
radius = 69.2604 radius = 69.2604
[node name="Drone" type="CharacterBody2D"] [node name="Drone" type="CharacterBody2D"]
collision_layer = 2
collision_mask = 15
script = ExtResource("1_qjiln") script = ExtResource("1_qjiln")
[node name="DroneImage" type="Sprite2D" parent="."] [node name="DroneImage" type="Sprite2D" parent="."]

View File

@ -10,56 +10,178 @@ resource_name = "interior"
texture = ExtResource("1_umx5j") texture = ExtResource("1_umx5j")
texture_region_size = Vector2i(390, 390) texture_region_size = Vector2i(390, 390)
0:0/0 = 0 0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0
1:0/0 = 0 1:0/0 = 0
1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:0/0/physics_layer_0/angular_velocity = 0.0
2:0/0 = 0 2:0/0 = 0
2:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
2:0/0/physics_layer_0/angular_velocity = 0.0
3:0/0 = 0 3:0/0 = 0
3:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
3:0/0/physics_layer_0/angular_velocity = 0.0
3:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-17, 34, 61, -38, 195, -70, 195, 68, 95, 100, 73, 195, -65, 195, -65, 116)
4:0/0 = 0 4:0/0 = 0
4:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
4:0/0/physics_layer_0/angular_velocity = 0.0
4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(195, 70, 195, -68, -195, -70, -195, 72)
5:0/0 = 0 5:0/0 = 0
5:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
5:0/0/physics_layer_0/angular_velocity = 0.0
5:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(17, 34, -61, -38, -195, -70, -195, 68, -95, 100, -73, 195, 65, 195, 65, 116)
6:0/0 = 0 6:0/0 = 0
6:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:0/0/physics_layer_0/angular_velocity = 0.0
6:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-70, 195, 72.5, 195, 72.5, 170, -71.5, 170)
0:1/0 = 0 0:1/0 = 0
0:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:1/0/physics_layer_0/angular_velocity = 0.0
1:1/0 = 0 1:1/0 = 0
1:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:1/0/physics_layer_0/angular_velocity = 0.0
2:1/0 = 0 2:1/0 = 0
2:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
2:1/0/physics_layer_0/angular_velocity = 0.0
3:1/0 = 0 3:1/0 = 0
3:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
3:1/0/physics_layer_0/angular_velocity = 0.0
3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-70, 195, 68, 195, 70, -195, -72, -195)
5:1/0 = 0 5:1/0 = 0
5:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
5:1/0/physics_layer_0/angular_velocity = 0.0
5:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-70, 195, 68, 195, 70, -195, -72, -195)
6:1/0 = 0 6:1/0 = 0
6:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:1/0/physics_layer_0/angular_velocity = 0.0
6:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-70, -195, 72.5, -195, 72.5, -170, -71.5, -170)
0:2/0 = 0 0:2/0 = 0
0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:2/0/physics_layer_0/angular_velocity = 0.0
1:2/0 = 0 1:2/0 = 0
1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:2/0/physics_layer_0/angular_velocity = 0.0
2:2/0 = 0 2:2/0 = 0
2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
2:2/0/physics_layer_0/angular_velocity = 0.0
3:2/0 = 0 3:2/0 = 0
3:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
3:2/0/physics_layer_0/angular_velocity = 0.0
3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-17, -34, 61, 38, 195, 70, 195, -68, 95, -100, 73, -195, -65, -195, -65, -116)
4:2/0 = 0 4:2/0 = 0
4:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
4:2/0/physics_layer_0/angular_velocity = 0.0
4:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(195, 70, 195, -68, -195, -70, -195, 72)
5:2/0 = 0 5:2/0 = 0
5:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
5:2/0/physics_layer_0/angular_velocity = 0.0
5:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(17, -34, -61, 38, -195, 70, -195, -68, -95, -100, -73, -195, 65, -195, 65, -116)
6:2/0 = 0 6:2/0 = 0
6:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:2/0/physics_layer_0/angular_velocity = 0.0
6:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-70, -195, 72.5, -195, 72.5, -170, -71.5, -170)
6:2/0/physics_layer_0/polygon_1/points = PackedVector2Array(69.5, 173, -71.5, 173, -71.5, 173, -70.5, 195, 70.5, 195)
0:3/0 = 0 0:3/0 = 0
0:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:3/0/physics_layer_0/angular_velocity = 0.0
1:3/0 = 0 1:3/0 = 0
1:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:3/0/physics_layer_0/angular_velocity = 0.0
2:3/0 = 0 2:3/0 = 0
2:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
2:3/0/physics_layer_0/angular_velocity = 0.0
6:3/0 = 0 6:3/0 = 0
6:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:3/0/physics_layer_0/angular_velocity = 0.0
6:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-195, 70, -195, -72.5, -170, -72.5, -170, 71.5)
0:4/0 = 0 0:4/0 = 0
0:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:4/0/physics_layer_0/angular_velocity = 0.0
1:4/0 = 0 1:4/0 = 0
1:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:4/0/physics_layer_0/angular_velocity = 0.0
2:4/0 = 0 2:4/0 = 0
2:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
2:4/0/physics_layer_0/angular_velocity = 0.0
6:4/0 = 0 6:4/0 = 0
6:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:4/0/physics_layer_0/angular_velocity = 0.0
6:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(195, -70, 195, 72.5, 170, 72.5, 170, -71.5)
0:5/0 = 0 0:5/0 = 0
0:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:5/0/physics_layer_0/angular_velocity = 0.0
1:5/0 = 0 1:5/0 = 0
1:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:5/0/physics_layer_0/angular_velocity = 0.0
0:6/0 = 0 0:6/0 = 0
0:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:6/0/physics_layer_0/angular_velocity = 0.0
0:6/0/physics_layer_0/polygon_0/points = PackedVector2Array(195, 21.3816, 195, -23.1634, -195, -21.2132, -195, 18.2688)
1:6/0 = 0 1:6/0 = 0
1:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:6/0/physics_layer_0/angular_velocity = 0.0
1:6/0/physics_layer_0/polygon_0/points = PackedVector2Array(21.3816, -195, -23.1634, -195, -21.2132, 195, 18.2688, 195)
3:6/0 = 0 3:6/0 = 0
3:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
3:6/0/physics_layer_0/angular_velocity = 0.0
3:6/0/physics_layer_0/polygon_0/points = PackedVector2Array(-22.4492, -19.0819, -195, -19.0819, -195, 21.3267, -17.4715, 18.4285, -19.8425, 195, 19.8425, 195, 16.6677, 19.0488, 195, 21.3816, 195, -23.1634, 16.9271, -21.3816, 20.6362, -195, -21.4299, -195)
5:6/0 = 0 5:6/0 = 0
5:6/0/physics_layer_0/linear_velocity = Vector2(0, 0)
5:6/0/physics_layer_0/angular_velocity = 0.0
5:6/0/physics_layer_0/polygon_0/points = PackedVector2Array(-21.3816, 195, 23.1634, 195, 20.1587, 16.379, -20.4907, 19.1543)
0:7/0 = 0 0:7/0 = 0
0:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:7/0/physics_layer_0/angular_velocity = 0.0
0:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(22.4492, 19.0819, 195, 19.0819, 195, -21.3267, -17.4614, -17.8583, -20.6362, 195, 21.4299, 195)
1:7/0 = 0 1:7/0 = 0
1:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:7/0/physics_layer_0/angular_velocity = 0.0
1:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-19.0819, 22.4492, -19.0819, 195, 21.3267, 195, 17.8583, -17.4614, -195, -20.6362, -195, 21.4299)
2:7/0 = 0 2:7/0 = 0
2:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
2:7/0/physics_layer_0/angular_velocity = 0.0
2:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(22.4492, 19.0819, 195, 19.0819, 195, -21.3267, -17.4614, -17.8583, -195, -21.3816, -195, 23.1634, -16.9271, 21.3816, -20.6362, 195, 21.4299, 195)
3:7/0 = 0 3:7/0 = 0
3:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
3:7/0/physics_layer_0/angular_velocity = 0.0
3:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-19.0819, 22.4492, -19.0819, 195, 21.3267, 195, 17.8583, -17.4614, 21.3816, -195, -23.1634, -195, -21.3816, -16.9271, -195, -20.6362, -195, 21.4299)
4:7/0 = 0 4:7/0 = 0
4:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
4:7/0/physics_layer_0/angular_velocity = 0.0
4:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(195, 21.3816, 195, -23.1634, 16.379, -20.1587, 19.1543, 20.4907)
6:7/0 = 0 6:7/0 = 0
6:7/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:7/0/physics_layer_0/angular_velocity = 0.0
6:7/0/physics_layer_0/polygon_0/points = PackedVector2Array(-195, -21.3816, -195, 23.1634, -16.379, 20.1587, -19.1543, -20.4907)
0:8/0 = 0 0:8/0 = 0
0:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:8/0/physics_layer_0/angular_velocity = 0.0
0:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(19.0819, -22.4492, 19.0819, -195, -21.3267, -195, -17.8583, 17.4614, 195, 20.6362, 195, -21.4299)
1:8/0 = 0 1:8/0 = 0
1:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
1:8/0/physics_layer_0/angular_velocity = 0.0
1:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-22.4492, -19.0819, -195, -19.0819, -195, 21.3267, 17.4614, 17.8583, 20.6362, -195, -21.4299, -195)
2:8/0 = 0 2:8/0 = 0
2:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
2:8/0/physics_layer_0/angular_velocity = 0.0
2:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(19.0819, -22.4492, 19.0819, -195, -21.3267, -195, -17.8583, 17.4614, -21.3816, 195, 23.1634, 195, 21.3816, 16.9271, 195, 20.6362, 195, -21.4299)
3:8/0 = 0 3:8/0 = 0
3:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
3:8/0/physics_layer_0/angular_velocity = 0.0
3:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(-22.4492, -19.0819, -195, -19.0819, -195, 21.3267, 17.4614, 17.8583, 195, 21.3816, 195, -23.1634, 16.9271, -21.3816, 20.6362, -195, -21.4299, -195)
5:8/0 = 0 5:8/0 = 0
5:8/0/physics_layer_0/linear_velocity = Vector2(0, 0)
5:8/0/physics_layer_0/angular_velocity = 0.0
5:8/0/physics_layer_0/polygon_0/points = PackedVector2Array(21.3816, -195, -23.1634, -195, -20.1587, -16.379, 20.4907, -19.1543)
[sub_resource type="TileSet" id="TileSet_kpfoq"] [sub_resource type="TileSet" id="TileSet_kpfoq"]
tile_size = Vector2i(390, 390) tile_size = Vector2i(390, 390)
physics_layer_0/collision_layer = 4
physics_layer_0/collision_mask = 11
sources/0 = SubResource("TileSetAtlasSource_svvnt") sources/0 = SubResource("TileSetAtlasSource_svvnt")
[node name="House" type="Area2D"] [node name="House" type="Area2D"]
collision_layer = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(389.5, -7.5) position = Vector2(389.5, -7.5)

View File

@ -101,7 +101,7 @@ layer_1/z_index = 0
layer_1/tile_data = PackedInt32Array(-65531, 65536, 2, -65530, 65536, 0, -65529, 65536, 0, -65528, 65536, 0, -65527, 65536, 0, -65526, 65536, 0, -65525, 65536, 0, -65524, 65536, 0, -65523, 65536, 0, -65522, 65536, 0, -131067, 0, 2, -196603, 0, 2, -262139, 0, 2, -327675, 0, 2, -393211, 0, 2, -458747, 0, 2, -393220, 0, 2, -327684, 0, 2, -262148, 0, 2, -196612, 0, 2, -131076, 0, 2, -65540, 0, 2, -4, 131072, 2, -5, 65536, 0, -6, 65536, 0, -7, 65536, 0, -8, 65536, 0, -9, 65536, 0, -10, 65536, 0, -11, 65536, 0, -12, 65536, 0, -13, 65536, 0, -14, 65536, 0, -15, 65536, 0) layer_1/tile_data = PackedInt32Array(-65531, 65536, 2, -65530, 65536, 0, -65529, 65536, 0, -65528, 65536, 0, -65527, 65536, 0, -65526, 65536, 0, -65525, 65536, 0, -65524, 65536, 0, -65523, 65536, 0, -65522, 65536, 0, -131067, 0, 2, -196603, 0, 2, -262139, 0, 2, -327675, 0, 2, -393211, 0, 2, -458747, 0, 2, -393220, 0, 2, -327684, 0, 2, -262148, 0, 2, -196612, 0, 2, -131076, 0, 2, -65540, 0, 2, -4, 131072, 2, -5, 65536, 0, -6, 65536, 0, -7, 65536, 0, -8, 65536, 0, -9, 65536, 0, -10, 65536, 0, -11, 65536, 0, -12, 65536, 0, -13, 65536, 0, -14, 65536, 0, -15, 65536, 0)
[node name="House" parent="Ground" instance=ExtResource("11_rxhcj")] [node name="House" parent="Ground" instance=ExtResource("11_rxhcj")]
position = Vector2(-1562, 3718) position = Vector2(-1362, 2526)
rotation = -2.31447 rotation = -2.31447
scale = Vector2(0.717171, 0.717171) scale = Vector2(0.717171, 0.717171)

View File

@ -8,6 +8,8 @@
size = Vector2(634, 368) size = Vector2(634, 368)
[node name="Bed" type="StaticBody2D"] [node name="Bed" type="StaticBody2D"]
collision_layer = 4
collision_mask = 11
[node name="BedImage" type="Sprite2D" parent="."] [node name="BedImage" type="Sprite2D" parent="."]
position = Vector2(328, 196) position = Vector2(328, 196)

View File

@ -6,6 +6,8 @@
size = Vector2(1230, 64) size = Vector2(1230, 64)
[node name="Billboard" type="StaticBody2D"] [node name="Billboard" type="StaticBody2D"]
collision_layer = 4
collision_mask = 11
[node name="BillboardImage" type="Sprite2D" parent="."] [node name="BillboardImage" type="Sprite2D" parent="."]
texture = ExtResource("1_1fjj1") texture = ExtResource("1_1fjj1")

View File

@ -7,6 +7,8 @@
size = Vector2(849, 190) size = Vector2(849, 190)
[node name="Gate" type="StaticBody2D"] [node name="Gate" type="StaticBody2D"]
collision_layer = 4
collision_mask = 11
script = ExtResource("1_bt2bt") script = ExtResource("1_bt2bt")
[node name="GateImage" type="Sprite2D" parent="."] [node name="GateImage" type="Sprite2D" parent="."]
@ -16,6 +18,7 @@ texture = ExtResource("1_b6nv8")
polygon = PackedVector2Array(-1420, -758, -1414, 608, -1240, 746, -371, 776, -365, 494, 534, 530, 504, 758, 1379, 782, 1546, 614, 1546, -764) polygon = PackedVector2Array(-1420, -758, -1414, 608, -1240, 746, -371, 776, -365, 494, 534, 530, 504, 758, 1379, 782, 1546, 614, 1546, -764)
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
collision_layer = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(66.5, 685) position = Vector2(66.5, 685)

View File

@ -36,8 +36,8 @@ func _process(_delta):
func _on_laser_timeout(): func _on_laser_timeout():
can_laser = true # Replace with function body. can_laser = true
func _on_grenade_timer_timeout(): func _on_grenade_timer_timeout():
can_grenade = true # Replace with function body. can_grenade = true

View File

@ -8,6 +8,7 @@
radius = 12.641 radius = 12.641
[node name="Player" type="CharacterBody2D"] [node name="Player" type="CharacterBody2D"]
collision_mask = 31
script = ExtResource("1_v2hsv") script = ExtResource("1_v2hsv")
[node name="PlayerImage" type="Sprite2D" parent="."] [node name="PlayerImage" type="Sprite2D" parent="."]

View File

@ -10,7 +10,9 @@ bounce = 0.4
[sub_resource type="CircleShape2D" id="CircleShape2D_meux2"] [sub_resource type="CircleShape2D" id="CircleShape2D_meux2"]
radius = 30.0 radius = 30.0
[node name="RigidBody2D" type="RigidBody2D"] [node name="Grenade" type="RigidBody2D"]
collision_layer = 8
collision_mask = 15
physics_material_override = SubResource("PhysicsMaterial_il4va") physics_material_override = SubResource("PhysicsMaterial_il4va")
gravity_scale = 0.0 gravity_scale = 0.0
linear_damp = 1.6 linear_damp = 1.6

View File

@ -8,6 +8,8 @@ radius = 7.0
height = 108.0 height = 108.0
[node name="Laser" type="Area2D"] [node name="Laser" type="Area2D"]
collision_layer = 8
collision_mask = 7
script = ExtResource("1_kk2rs") script = ExtResource("1_kk2rs")
speed = 2000 speed = 2000