Преглед изворни кода

Configure les calques de collision

DricomDragon пре 11 месеци
родитељ
комит
bd197d9b1a

+ 3 - 2
godot/composants/objets/arene/arene.tscn

@@ -1,6 +1,6 @@
 [gd_scene load_steps=4 format=3 uid="uid://b28d5a4be36qa"]
 
-[ext_resource type="PhysicsMaterial" uid="uid://c6bddricwmcxx" path="res://ressources/materiaux/metal.tres" id="1_jdr4h"]
+[ext_resource type="PhysicsMaterial" uid="uid://c6bddricwmcxx" path="res://ressources/materiaux/metal.tres" id="1_h5k8j"]
 
 [sub_resource type="RectangleShape2D" id="RectangleShape2D_cjamf"]
 size = Vector2(820, 200)
@@ -9,7 +9,8 @@ size = Vector2(820, 200)
 size = Vector2(200, 1200)
 
 [node name="Arene" type="StaticBody2D"]
-physics_material_override = ExtResource("1_jdr4h")
+collision_layer = 4
+physics_material_override = ExtResource("1_h5k8j")
 
 [node name="Haut" type="CollisionShape2D" parent="."]
 position = Vector2(210, -100)

+ 3 - 0
godot/composants/objets/balle/balle.tscn

@@ -7,8 +7,11 @@
 radius = 5.42
 
 [node name="Balle" type="CharacterBody2D"]
+collision_mask = 22
 motion_mode = 1
 wall_min_slide_angle = 0.0
+platform_floor_layers = 2
+platform_wall_layers = 4
 script = ExtResource("1_ssf8u")
 
 [node name="Image" type="Sprite2D" parent="."]

+ 3 - 2
godot/composants/objets/brique/brique.tscn

@@ -1,6 +1,6 @@
 [gd_scene load_steps=5 format=3 uid="uid://brd8yid3l7wgm"]
 
-[ext_resource type="PhysicsMaterial" uid="uid://c6bddricwmcxx" path="res://ressources/materiaux/metal.tres" id="1_n3uct"]
+[ext_resource type="PhysicsMaterial" uid="uid://c6bddricwmcxx" path="res://ressources/materiaux/metal.tres" id="1_exny1"]
 [ext_resource type="Script" path="res://composants/objets/brique/brique.gd" id="2_gkrr0"]
 [ext_resource type="Texture2D" uid="uid://r7iyjvdve5a1" path="res://composants/objets/brique/01.png" id="3_fmy5a"]
 
@@ -8,7 +8,8 @@
 size = Vector2(30, 16)
 
 [node name="Brique" type="StaticBody2D"]
-physics_material_override = ExtResource("1_n3uct")
+collision_layer = 16
+physics_material_override = ExtResource("1_exny1")
 script = ExtResource("2_gkrr0")
 
 [node name="Image" type="Sprite2D" parent="."]

+ 0 - 1
godot/composants/objets/capsule/capsule.gd

@@ -15,7 +15,6 @@ func _descendre(delta: float) -> void:
 
 
 func _auto_detruire() -> void:
-	print("Capsule perdue")
 	queue_free()
 
 

+ 2 - 0
godot/composants/objets/capsule/capsule.tscn

@@ -18,6 +18,8 @@ centered = false
 
 [node name="ZoneActivation" type="Area2D" parent="."]
 position = Vector2(15, 8)
+collision_layer = 8
+collision_mask = 2
 
 [node name="FormeZone" type="CollisionShape2D" parent="ZoneActivation"]
 rotation = 1.5708

+ 4 - 2
godot/composants/objets/raquette/raquette.tscn

@@ -1,6 +1,6 @@
 [gd_scene load_steps=5 format=3 uid="uid://cpo1b44exbbyf"]
 
-[ext_resource type="PhysicsMaterial" uid="uid://c6bddricwmcxx" path="res://ressources/materiaux/metal.tres" id="1_0thl6"]
+[ext_resource type="PhysicsMaterial" uid="uid://c6bddricwmcxx" path="res://ressources/materiaux/metal.tres" id="1_cuq4l"]
 [ext_resource type="Script" path="res://composants/objets/raquette/raquette.gd" id="2_t4r17"]
 [ext_resource type="Texture2D" uid="uid://blc5i1iovhwuw" path="res://composants/objets/raquette/sprite.png" id="3_n2v48"]
 
@@ -8,7 +8,9 @@
 size = Vector2(120, 14)
 
 [node name="Raquette" type="StaticBody2D"]
-physics_material_override = ExtResource("1_0thl6")
+collision_layer = 2
+collision_mask = 9
+physics_material_override = ExtResource("1_cuq4l")
 script = ExtResource("2_t4r17")
 
 [node name="Image" type="Sprite2D" parent="."]

+ 8 - 0
godot/project.godot

@@ -47,6 +47,14 @@ ui_clic={
 ]
 }
 
+[layer_names]
+
+2d_physics/layer_1="balle"
+2d_physics/layer_2="raquette"
+2d_physics/layer_3="mur"
+2d_physics/layer_4="capsule"
+2d_physics/layer_5="brique"
+
 [rendering]
 
 renderer/rendering_method="gl_compatibility"