Переглянути джерело

:wrench: Fait perdre la partie quand une brique sort du terrain

Fonctionne que sur le niveau dart.
DricomDragon 9 місяців тому
батько
коміт
441d62798d

+ 6 - 1
godot/composants/objets/arene/arene.gd

@@ -2,13 +2,18 @@ extends Node2D
 
 
 signal balle_detruite
+signal brique_sortie
 
 
 func _quand_zone_exterieure_detecte_entree(corps: Node2D) -> void:
-	if corps is Balle: # toujours le cas si calque collision bien regle
+	if corps is Balle:
 		_traiter_balle_sortie(corps)
 
 
 func _traiter_balle_sortie(balle: Balle) -> void:
 	balle.detruire()
 	balle_detruite.emit()
+
+
+func _quand_zone_exterieure_detecte_entree_zone(area_rid, area, area_shape_index, local_shape_index) -> void:
+	brique_sortie.emit()

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

@@ -32,9 +32,11 @@ shape = SubResource("RectangleShape2D_d3hv4")
 [node name="ZoneExterieure" type="Area2D" parent="."]
 position = Vector2(210, 642)
 collision_layer = 4
+collision_mask = 17
 monitorable = false
 
 [node name="FormeZone" type="CollisionShape2D" parent="ZoneExterieure"]
 shape = SubResource("RectangleShape2D_u5oj2")
 
+[connection signal="area_shape_entered" from="ZoneExterieure" to="." method="_quand_zone_exterieure_detecte_entree_zone"]
 [connection signal="body_entered" from="ZoneExterieure" to="." method="_quand_zone_exterieure_detecte_entree"]

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

@@ -1,10 +1,13 @@
-[gd_scene load_steps=5 format=3 uid="uid://brd8yid3l7wgm"]
+[gd_scene load_steps=6 format=3 uid="uid://brd8yid3l7wgm"]
 
 [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/images/01.png" id="3_72vd6"]
 
 [sub_resource type="RectangleShape2D" id="RectangleShape2D_ong6t"]
+size = Vector2(40, 26)
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_tnj5s"]
 size = Vector2(30, 16)
 
 [node name="Brique" type="StaticBody2D"]
@@ -12,10 +15,20 @@ collision_layer = 16
 physics_material_override = ExtResource("1_exny1")
 script = ExtResource("2_gkrr0")
 
+[node name="ZoneInfluence" type="Area2D" parent="."]
+collision_layer = 16
+collision_mask = 20
+monitoring = false
+
+[node name="FormeInfluence" type="CollisionShape2D" parent="ZoneInfluence"]
+position = Vector2(15, 8)
+shape = SubResource("RectangleShape2D_ong6t")
+
 [node name="Image" type="Sprite2D" parent="."]
 texture = ExtResource("3_72vd6")
 centered = false
 
-[node name="Forme" type="CollisionShape2D" parent="."]
+[node name="FormeRebond" type="CollisionShape2D" parent="."]
 position = Vector2(15, 8)
-shape = SubResource("RectangleShape2D_ong6t")
+shape = SubResource("RectangleShape2D_tnj5s")
+debug_color = Color(1, 0.6, 0.701961, 0.419608)

+ 3 - 0
godot/exec/niveaux/falling_dart.tscn

@@ -230,3 +230,6 @@ bus = &"Musique"
 [connection signal="plus_de_briques" from="Briques" to="Message" method="show"]
 [connection signal="plus_de_briques" from="Briques" to="Message/Gagne" method="show"]
 [connection signal="balle_detruite" from="Arene" to="Lanceur" method="_quand_balle_detruite"]
+[connection signal="brique_sortie" from="Arene" to="Lanceur" method="queue_free"]
+[connection signal="brique_sortie" from="Arene" to="Message" method="show"]
+[connection signal="brique_sortie" from="Arene" to="Message/Perdu" method="show"]