Le z-indexeur est là pour z-indexer tous ces petits gars

Quand il rentre en action il trouve si quelqu'un est en collision
Et il prend la hauteur de cette personne et se place au dessus
Il est comme ça le zindexeur, il est sans gêne
This commit is contained in:
Thomas
2025-02-22 09:21:28 +01:00
parent ec29c50631
commit 5721680834
9 changed files with 128 additions and 58 deletions

View File

@@ -8,6 +8,8 @@ extends PathFollow2D
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if position.distance_to(car.position) < 200:
progress_ratio += delta * speed;
if position.distance_to(car.position) < distanceMax:
progress += car.speed * delta
if progress_ratio > 1:
progress_ratio = progress_ratio - 1
car.moveTo(position);

View File

@@ -13,9 +13,9 @@ point_count = 15
[sub_resource type="Curve2D" id="Curve2D_nircx"]
_data = {
"points": PackedVector2Array(0, 0, 0, 0, 803, 1569, 0, 0, 0, 0, 910, 1573, 0, 0, 0, 0, 913, 1368, 0, 0, 0, 0, 1926, 1371, 0, 0, 0, 0, 1931, 342, 0, 0, 0, 0, 2082, 333, 0, 0, 0, 0, 2060, -140, 0, 0, 0, 0, 1718, -143, 0, 0, 0, 0, 1649, 73, 0, 0, 0, 0, 814, 68, 0, 0, 0, 0, 897, -123, 0, 0, 0, 0, 904, -1165, 0, 0, 0, 0, -890, -1162, 0, 0, 0, 0, -886, -119, 0, 0, 0, 0, -1062, -106, 0, 0, 0, 0, -1076, 268, 0, 0, 0, 0, -630, 271, 0, 0, 0, 0, -616, 161, 0, 0, 0, 0, 858, 167, 0, 0, 0, 0, 806, 1560)
"points": PackedVector2Array(0, 0, 0, 0, 803, 1569, 0, 0, 0, 0, 910, 1573, 0, 0, 0, 0, 913, 1368, 0, 0, 0, 0, 1926, 1371, 0, 0, 0, 0, 1931, 342, 0, 0, 0, 0, 2082, 333, 0, 0, 0, 0, 2060, -140, 0, 0, 0, 0, 1718, -143, 0, 0, 0, 0, 1649, 73, 0, 0, 0, 0, 899, 51, 0, 0, 0, 0, 904, -1165, 0, 0, 0, 0, -890, -1162, 0, 0, 0, 0, -886, -119, 0, 0, 0, 0, -1062, -106, 0, 0, 0, 0, -1076, 268, 0, 0, 0, 0, -630, 271, 0, 0, 0, 0, -616, 161, 0, 0, 0, 0, 858, 167, 0, 0, 0, 0, 806, 1560)
}
point_count = 20
point_count = 19
[node name="scene1" type="Node2D"]
@@ -23,7 +23,7 @@ point_count = 20
[node name="movibles" type="Node2D" parent="."]
[node name="Area2D" parent="movibles" instance=ExtResource("2_5x6b5")]
[node name="player" parent="movibles" instance=ExtResource("2_5x6b5")]
position = Vector2(87, 74)
[node name="voitures" type="Node" parent="movibles"]
@@ -48,8 +48,14 @@ curve = SubResource("Curve2D_nircx")
[node name="voiture_pnj" parent="movibles/voitures/Path2D2" node_paths=PackedStringArray("car") instance=ExtResource("3_yuakw")]
position = Vector2(803, 1569)
car = NodePath("../Car")
distanceMax = 15
speed = 0.1
distanceMax = 150
[node name="Label" type="Label" parent="movibles/voitures/Path2D2/voiture_pnj"]
offset_right = 40.0
offset_bottom = 23.0
text = "LAPIN"
[node name="Car" parent="movibles/voitures/Path2D2" instance=ExtResource("4_bqm78")]
position = Vector2(803, 1558)
speed = 500
speed = 400