fix: james sigth + improve collision management

This commit is contained in:
Varylios 2025-09-14 11:38:05 +02:00
parent d352574618
commit ad5d9b8d82
6 changed files with 13 additions and 10 deletions

View file

@ -6,7 +6,7 @@
sky_top_color = Color(0.560784, 0.658824, 0.886275, 1)
sky_horizon_color = Color(0.686275, 0.737255, 0.870588, 1)
sky_cover = ExtResource("1_ll0pl")
ground_bottom_color = Color(0.188235, 0.529412, 0.490196, 1)
ground_bottom_color = Color(0.0941176, 0.403922, 0.376471, 1)
ground_horizon_color = Color(0.686275, 0.737255, 0.870588, 1)
[resource]

View file

@ -20,7 +20,7 @@ metadata/_custom_type_script = "uid://ddgbr0n8kic3y"
viewport_path = NodePath("Enemy/HealthBar3D/SubViewport")
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_tviqb"]
points = PackedVector3Array(0, 0, 0, -2, 1, 3, 2, 1, 3, 2, 0, 3, -2, 0, 3)
points = PackedVector3Array(0, 0, 0, -1.5, 1, -3, 1.5, 1, -3, 1.5, 0, -3, -1.5, 0, -3)
[node name="PathFollow3D" instance=ExtResource("1_ohyx6")]

View file

@ -28,8 +28,6 @@ var is_alive : bool = true
func _ready() -> void:
healthBar.max_value = max_life
$CubeAttackRange.body_entered.connect(onAttackRangeBodyEntered)
$CubeAttackRange.body_exited.connect(onAttackRangeBodyExited)
func _physics_process(delta: float) -> void:

View file

@ -79,3 +79,6 @@ debug_color = Color(0.994297, 0, 0.224345, 0.42)
[node name="AttackCooldown" type="Timer" parent="Enemy"]
wait_time = 4.0
one_shot = true
[connection signal="body_entered" from="Enemy/CubeAttackRange" to="Enemy" method="onAttackRangeBodyEntered"]
[connection signal="body_exited" from="Enemy/CubeAttackRange" to="Enemy" method="onAttackRangeBodyExited"]

View file

@ -161,13 +161,12 @@ func onBodyExited(body: Node3D) -> void:
func toggleConnection(activate : bool) -> void:
if activate && not $Range.body_entered.is_connected(onBodyEntered):
$Range.body_entered.connect(onBodyEntered)
$Range.body_exited.connect(onBodyExited)
if activate:
$Range.monitorable = true
$Range.monitoring = true
else:
if $Range.body_entered.is_connected(onBodyEntered):
$Range.body_entered.disconnect(onBodyEntered)
$Range.body_exited.disconnect(onBodyExited)
$Range.monitorable = false
$Range.monitoring = false
availableTargets.clear()

View file

@ -92,3 +92,6 @@ metadata/_custom_type_script = "uid://blnmjxmusrsa7"
[node name="PriceTag" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
billboard = 2
[connection signal="body_entered" from="Range" to="." method="onBodyEntered"]
[connection signal="body_exited" from="Range" to="." method="onBodyExited"]